Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
zsolt is currently offline  zsolt
Messages: 697
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
Re: Bugfix AsGate64() works correctly on totals > 2^31 [message #52833 is a reply to message #52829] Sun, 08 December 2019 08:47 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Applied.
Previous Topic: Bugfix: GZCompressFile() and GZDecompressFile() not crashing on files bigger than 2 GB
Next Topic: AsyncWork<Vector<T>> fails due to lack of copy-constructor
Goto Forum:
  


Current Time: Wed Apr 24 07:22:20 CEST 2024

Total time taken to generate the page: 0.05890 seconds