Use macros for operating on int64_t quantities, even in platform code:
----------------------------------------------------------------
The macros allow int64_t quantities to be manipulated, even if they
are implemented as structures.
The win32 code, although platform specific, is used as a basis for
other platforms.
Macros should be used for 64-bit arithmetic throughout the code, even
for platform specific code. Thius makes porting much easier on platforms
without 64-bit integers.
The macros will reduce to normal 64-bit arithmetic on Win32, with
no loss in performance, and only a little loss in code readablity.
As a test, it should be possible to
compile Win32 code using a structure for int64_t quantities.
E.g.
typedef struct {
__int64 val;
} int64_t;
#define ll_add(x, y) ((x).val + (y).val)
etc.
(jni_invoke_native may need changing for return types, but the rest of
the product should compile fine).
----------------------------------------------------------------
The macros allow int64_t quantities to be manipulated, even if they
are implemented as structures.
The win32 code, although platform specific, is used as a basis for
other platforms.
Macros should be used for 64-bit arithmetic throughout the code, even
for platform specific code. Thius makes porting much easier on platforms
without 64-bit integers.
The macros will reduce to normal 64-bit arithmetic on Win32, with
no loss in performance, and only a little loss in code readablity.
As a test, it should be possible to
compile Win32 code using a structure for int64_t quantities.
E.g.
typedef struct {
__int64 val;
} int64_t;
#define ll_add(x, y) ((x).val + (y).val)
etc.
(jni_invoke_native may need changing for return types, but the rest of
the product should compile fine).
- duplicates
-
JDK-4110531 (porting) use of jlong and int64_t must always use macros
-
- Closed
-