diff options
author | David Allsopp <david.allsopp@metastack.com> | 2016-01-09 14:04:38 +0000 |
---|---|---|
committer | alainfrisch <alain@frisch.fr> | 2016-03-10 10:56:02 +0100 |
commit | 709d89b438df7982cd6ab41c9663e9949b5a9bdc (patch) | |
tree | b7ddb5f898fae7cd52211d8f746cf67d5fe8e4c4 | |
parent | 19dee481ea924a778dfb4c288287db7071631714 (diff) | |
download | ocaml-709d89b438df7982cd6ab41c9663e9949b5a9bdc.tar.gz |
Fix compilation using Visual Studio .NET 2002
Microsoft introduced the `LL` suffix for integer literals in Visual
Studio .NET 2003 - earlier versions use `i64`
-rw-r--r-- | byterun/ints.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/byterun/ints.c b/byterun/ints.c index 6141f2b99c..40b2e4902f 100644 --- a/byterun/ints.c +++ b/byterun/ints.c @@ -499,18 +499,25 @@ value caml_int64_direct_bswap(value v) { return caml_swap64(v); } #endif +/* Microsoft introduced the LL integer literal suffix in Visual C++ .NET 2003 */ +#if defined(_MSC_VER) && _MSC_VER < 1400 +#define INT64_LITERAL(s) s ## i64 +#else +#define INT64_LITERAL(s) s ## LL +#endif + CAMLprim value caml_int64_bswap(value v) { int64_t x = Int64_val(v); return caml_copy_int64 - (((x & 0x00000000000000FFULL) << 56) | - ((x & 0x000000000000FF00ULL) << 40) | - ((x & 0x0000000000FF0000ULL) << 24) | - ((x & 0x00000000FF000000ULL) << 8) | - ((x & 0x000000FF00000000ULL) >> 8) | - ((x & 0x0000FF0000000000ULL) >> 24) | - ((x & 0x00FF000000000000ULL) >> 40) | - ((x & 0xFF00000000000000ULL) >> 56)); + (((x & INT64_LITERAL(0x00000000000000FFU)) << 56) | + ((x & INT64_LITERAL(0x000000000000FF00U)) << 40) | + ((x & INT64_LITERAL(0x0000000000FF0000U)) << 24) | + ((x & INT64_LITERAL(0x00000000FF000000U)) << 8) | + ((x & INT64_LITERAL(0x000000FF00000000U)) >> 8) | + ((x & INT64_LITERAL(0x0000FF0000000000U)) >> 24) | + ((x & INT64_LITERAL(0x00FF000000000000U)) >> 40) | + ((x & INT64_LITERAL(0xFF00000000000000U)) >> 56)); } CAMLprim value caml_int64_of_int(value v) |