Skip to content

Commit 4c051fb

Browse files
committed
Use GCC intrinsics if available
1 parent 18e2868 commit 4c051fb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Firenzina/utility.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,25 +439,33 @@ void GetSysInfo()
439439

440440
void SetPOPCNT()
441441
{
442+
#ifndef WINDOWS
443+
POPCNT= &__builtin_popcountll;
444+
445+
Send("Using GCC builtin POPCNT\n");
446+
447+
#else
442448
int CPUInfo[4] = {-1};
443449
__cpuid(CPUInfo, 0x00000001);
444450
HasPopcnt = (CPUInfo[2] >> 23) & 1;
445451
if(HasPopcnt)
446452
{
447453
POPCNT = &PopcntHard;
448-
Send("Hardware POPCNT supported\n\n");
454+
455+
Send("Hardware POPCNT supported\n");
449456

450457
#ifdef Log
451458
if (WriteLog)
452459
{
453460
log_file = fopen(log_filename, "a");
454-
fprintf(log_file, "Hardware POPCNT supported\n\n");
461+
fprintf(log_file, "Hardware POPCNT supported\n");
455462
close_log();
456463
}
457464
#endif
458465
}
459466
else
460467
POPCNT = &PopcntEmul;
468+
#endif
461469
}
462470

463471
#ifdef Log

0 commit comments

Comments
 (0)