Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / byterun / int64_native.h
blobf5bef4a6f43204a78cab74ef41d84e750216075b
1 /***********************************************************************/
2 /* */
3 /* Objective Caml */
4 /* */
5 /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
6 /* */
7 /* Copyright 2002 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../LICENSE. */
11 /* */
12 /***********************************************************************/
14 /* $Id$ */
16 /* Wrapper macros around native 64-bit integer arithmetic,
17 so that it has the same interface as the software emulation
18 provided in int64_emul.h */
20 #ifndef CAML_INT64_NATIVE_H
21 #define CAML_INT64_NATIVE_H
23 #define I64_literal(hi,lo) ((int64)(hi) << 32 | (lo))
24 #define I64_compare(x,y) (((x) > (y)) - ((x) < (y)))
25 #define I64_ult(x,y) ((uint64)(x) < (uint64)(y))
26 #define I64_neg(x) (-(x))
27 #define I64_add(x,y) ((x) + (y))
28 #define I64_sub(x,y) ((x) - (y))
29 #define I64_mul(x,y) ((x) * (y))
30 #define I64_is_zero(x) ((x) == 0)
31 #define I64_is_negative(x) ((x) < 0)
32 #define I64_div(x,y) ((x) / (y))
33 #define I64_mod(x,y) ((x) % (y))
34 #define I64_udivmod(x,y,quo,rem) \
35 (*(rem) = (uint64)(x) % (uint64)(y), \
36 *(quo) = (uint64)(x) / (uint64)(y))
37 #define I64_and(x,y) ((x) & (y))
38 #define I64_or(x,y) ((x) | (y))
39 #define I64_xor(x,y) ((x) ^ (y))
40 #define I64_lsl(x,y) ((x) << (y))
41 #define I64_asr(x,y) ((x) >> (y))
42 #define I64_lsr(x,y) ((uint64)(x) >> (y))
43 #define I64_to_intnat(x) ((intnat) (x))
44 #define I64_of_intnat(x) ((intnat) (x))
45 #define I64_to_int32(x) ((int32) (x))
46 #define I64_of_int32(x) ((int64) (x))
47 #define I64_to_double(x) ((double)(x))
48 #define I64_of_double(x) ((int64)(x))
50 #endif /* CAML_INT64_NATIVE_H */