Skip to content

Commit b8a27f5

Browse files
committed
glue.h: re-order macro definitions
1 parent 409940b commit b8a27f5

1 file changed

Lines changed: 17 additions & 19 deletions

File tree

src/main/native/glue/glue.h

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef _Included_glue
22
#define _Included_glue
33
/*
4-
Copyright (c) 2024-2025 Stephen Gold
4+
Copyright (c) 2024-2026 Stephen Gold
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal
@@ -68,6 +68,14 @@ extern std::atomic<JPH::uint32> gDeleteCount;
6868
#define TRACE_NEW_TARGET(className, pointer)
6969
#define TRACE_DELETE(className, pointer)
7070
#endif
71+
/*
72+
* pre-processor macro to generate code to access a direct ByteBuffer:
73+
*/
74+
#define DIRECT_BYTE_BUFFER(pEnv, byteBuffer, pBytes, capacityBytes) \
75+
jbyte * const pBytes = (jbyte *) (pEnv)->GetDirectBufferAddress(byteBuffer); \
76+
JPH_ASSERT(pBytes != NULL); \
77+
const jlong capacityBytes = (pEnv)->GetDirectBufferCapacity(byteBuffer); \
78+
JPH_ASSERT(capacityBytes >= 0)
7179
/*
7280
* pre-processor macro to generate code to access a direct DoubleBuffer:
7381
*/
@@ -88,28 +96,18 @@ extern std::atomic<JPH::uint32> gDeleteCount;
8896
* pre-processor macro to generate code to access a direct IntBuffer:
8997
*/
9098
#define DIRECT_INT_BUFFER(pEnv, intBuffer, pInts, capacityInts) \
91-
jint * const pInts = (jint *) (pEnv)->GetDirectBufferAddress(intBuffer); \
92-
JPH_ASSERT(pInts != NULL); \
93-
const jlong capacityInts = (pEnv)->GetDirectBufferCapacity(intBuffer); \
94-
JPH_ASSERT(capacityInts >= 0)
95-
96-
/*
97-
* pre-processor macro to generate code to access a direct ByteBuffer:
98-
*/
99-
#define DIRECT_BYTE_BUFFER(pEnv, byteBuffer, pBytes, capacityBytes) \
100-
jbyte * const pBytes = (jbyte *) (pEnv)->GetDirectBufferAddress(byteBuffer); \
101-
JPH_ASSERT(pBytes != NULL); \
102-
const jlong capacityBytes = (pEnv)->GetDirectBufferCapacity(byteBuffer); \
103-
JPH_ASSERT(capacityBytes >= 0)
104-
99+
jint * const pInts = (jint *) (pEnv)->GetDirectBufferAddress(intBuffer); \
100+
JPH_ASSERT(pInts != NULL); \
101+
const jlong capacityInts = (pEnv)->GetDirectBufferCapacity(intBuffer); \
102+
JPH_ASSERT(capacityInts >= 0)
105103
/*
106104
* pre-processor macro to generate code to access a direct LongBuffer:
107105
*/
108106
#define DIRECT_LONG_BUFFER(pEnv, longBuffer, pLongs, capacityLongs) \
109-
jlong * const pLongs = (jlong *) (pEnv)->GetDirectBufferAddress(longBuffer); \
110-
JPH_ASSERT(pLongs != NULL); \
111-
const jlong capacityLongs = (pEnv)->GetDirectBufferCapacity(longBuffer); \
112-
JPH_ASSERT(capacityLongs >= 0)
107+
jlong * const pLongs = (jlong *) (pEnv)->GetDirectBufferAddress(longBuffer); \
108+
JPH_ASSERT(pLongs != NULL); \
109+
const jlong capacityLongs = (pEnv)->GetDirectBufferCapacity(longBuffer); \
110+
JPH_ASSERT(capacityLongs >= 0)
113111
/*
114112
* pre-processor macros to generate the body of a static createCopy() method
115113
* to implement a copy constructor:

0 commit comments

Comments
 (0)