guint32 real_size = (max_size + BITS_PER_CHUNK - 1) / BITS_PER_CHUNK;
MonoBitSet *result;
- result = g_malloc0 (sizeof (MonoBitSet) + sizeof (gsize) * (real_size - MONO_ZERO_LEN_ARRAY));
+ result = (MonoBitSet *) g_malloc0 (sizeof (MonoBitSet) + sizeof (gsize) * (real_size - MONO_ZERO_LEN_ARRAY));
result->size = real_size * BITS_PER_CHUNK;
result->flags = flags;
return result;
MonoBitSet *
mono_bitset_mem_new (gpointer mem, guint32 max_size, guint32 flags) {
guint32 real_size = (max_size + BITS_PER_CHUNK - 1) / BITS_PER_CHUNK;
- MonoBitSet *result = mem;
+ MonoBitSet *result = (MonoBitSet *) mem;
result->size = real_size * BITS_PER_CHUNK;
result->flags = flags | MONO_BITSET_DONT_FREE;
for (i = 0; i < set->size / BITS_PER_CHUNK; ++i) {
d = set->data [i];
#ifdef __GNUC__
- count += __builtin_popcount (d);
+ if (sizeof (gsize) == sizeof (unsigned int))
+ count += __builtin_popcount (d);
+ else
+ count += __builtin_popcountll (d);
#else
while (d) {
count ++;