forked from Imagelibrary/seL4
trivial: fixes to popcountl implementation
This commit is contained in:
@@ -125,23 +125,21 @@ int __builtin_popcountl (unsigned long x);
|
||||
|
||||
/** DONT_TRANSLATE */
|
||||
static inline long
|
||||
CONST popcountl(unsigned long x)
|
||||
CONST popcountl(unsigned long v)
|
||||
{
|
||||
#ifndef __POPCNT__
|
||||
|
||||
unsigned int v; // count the number of bits set in v
|
||||
unsigned int c; // c accumulates the total bits set in v
|
||||
for (c = 0; v; c++) {
|
||||
v &= v - 1; // clear the least significant bit set
|
||||
}
|
||||
|
||||
return v;
|
||||
return c;
|
||||
#else
|
||||
return __builtin_popcountl(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define POPCOUNTL(x) popcountl
|
||||
#define POPCOUNTL(x) popcountl(x)
|
||||
|
||||
#else /* __ASSEMBLER__ */
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ static inline void init_ipi_args(IpiModeRemoteCall_t func,
|
||||
ipi_args[2] = data3;
|
||||
|
||||
/* get number of cores involved in this IPI */
|
||||
totalCoreBarrier = POPCOUNTL(mask);
|
||||
totalCoreBarrier = popcountl(mask);
|
||||
}
|
||||
|
||||
static void handleRemoteCall(IpiModeRemoteCall_t call, word_t arg0,
|
||||
|
||||
Reference in New Issue
Block a user