Home » U++ Library support » U++ Core » Bugfix AsGate64() works correctly on totals > 2^31
Bugfix AsGate64() works correctly on totals > 2^31 [message #52829] |
Sun, 08 December 2019 02:30 |
zsolt
Messages: 698 Registered: December 2005 Location: Budapest, Hungary
|
Contributor |
|
|
Gate<int64, int64> AsGate64(Gate<int, int> gate)
{
Gate<int64, int64> h;
- h << [=](int64 a, int64 b) { return gate((int)a, (int)b); };
+ h << [=](int64 a, int64 b) {
+ if(b > (int64)INT_MAX << 10){
+ return gate((int)(a>>32), (int)(b>>32));
+ }
+ if(b > INT_MAX){
+ return gate((int)(a>>22), (int)(b>>22));
+ }
+ return gate((int)a, (int)b);
+ };
return h;
}
Tested with MSC2017 32 bit
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 03:19:23 CEST 2024
Total time taken to generate the page: 0.02903 seconds
|