mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-22 19:29:06 +08:00
Avoid casting void* to uint64_t.
- Add new wrapper that accepts const void *. Change-Id: I1cea088b563cf704b6673844b533ce44f388e5fc Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
ee544e2515
commit
83c0f80431
@@ -45,6 +45,13 @@ TEST(PtrMath, givenCastToUint64FunctionWhenItIsCalledThenProperValueIsReturned)
|
||||
auto uintAddress = castToUint64(addressWithTrailingBitSet);
|
||||
EXPECT_EQ(uintAddress, expectedUint64Address);
|
||||
}
|
||||
TEST(PtrMath, givenCastToUint64FunctionWhenConstPointerIsPassedItIsCalledThenProperValueIsReturned) {
|
||||
uintptr_t address = 0xf0000000;
|
||||
const void *addressWithTrailingBitSet = reinterpret_cast<const void *>(address);
|
||||
uint64_t expectedUint64Address = 0xf0000000;
|
||||
auto uintAddress = castToUint64(addressWithTrailingBitSet);
|
||||
EXPECT_EQ(uintAddress, expectedUint64Address);
|
||||
}
|
||||
|
||||
TEST(ptrOffset, preserve64Bit) {
|
||||
uint64_t ptrBefore = 0x800000000;
|
||||
|
||||
Reference in New Issue
Block a user