[m-rev.] diff: fix int.{min,max}_int/0 on Windows 64
Julien Fischer
jfischer at opturion.com
Fri Mar 22 14:09:43 AEDT 2013
Fix int.{min,max}_int/0 on Windows 64.
library/int.m:
On 64-bit Windows MR_Integer has the same size as C's long long type; the
implementations of int.{min,max}_int/0 did not handle this case.
Julien.
diff --git a/library/int.m b/library/int.m
index 74cf8bd..d3f5a7c 100644
--- a/library/int.m
+++ b/library/int.m
@@ -671,6 +671,8 @@ int.max_int = X :-
Max = INT_MAX;
} else if (sizeof(MR_Integer) == sizeof(long)) {
Max = LONG_MAX;
+ } else if (sizeof(MR_Integer) == sizeof(long long)) {
+ Max = LONG_LONG_MAX;
} else {
MR_fatal_error(""Unable to figure out max integer size"");
}
@@ -688,6 +690,8 @@ int.min_int = X :-
Min = INT_MIN;
} else if (sizeof(MR_Integer) == sizeof(long)) {
Min = LONG_MIN;
+ } else if (sizeof(MR_Integer) == sizeof(long long)) {
+ Min = LONG_LONG_MIN;
} else {
MR_fatal_error(""Unable to figure out min integer size"");
}
More information about the reviews
mailing list