Skip to content

Commit

Permalink
Simplify address calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
eloj committed Nov 15, 2024
1 parent c279633 commit 2a86aae
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tiny_bvh_speedtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,17 @@ int main()

// determine what CPU is running the tests.
#if (defined(__x86_64__) || defined(_M_X64)) && (defined (_WIN32) || defined(__GNUC__))
char model[256]{};
char model[64]{};
for (unsigned i = 0; i < 3; ++i) {
#ifdef _WIN32
__cpuidex( (int*)(model + i * 16), i + 0x80000002, 0 );
#elif defined __GNUC__
__get_cpuid(i + 0x80000002, (unsigned int*)(model+ i * 16 + 0), (unsigned int*)(model + i * 16 + 4), (unsigned int*)(model + i * 16 + 8), (unsigned int*)(model + i * 16 + 12));
#elif defined(__GNUC__)
__get_cpuid(i + 0x80000002,
(unsigned int*)(model) + i * 4 + 0,
(unsigned int*)(model) + i * 4 + 1,
(unsigned int*)(model) + i * 4 + 2,
(unsigned int*)(model) + i * 4 + 3
);
#endif
}
printf( "running on %s\n", model );
Expand Down

0 comments on commit 2a86aae

Please sign in to comment.