278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
set.idvmap = o
set.null = quote var s: set s:clear() in s end
set.name = string.format('set<%s>', table.concat(tbl, '|'))
set.metamethods.__entrymissing = macro(function(val, obj)
if o[val] == nil then error('value ' .. val .. ' not in set') end
return `bit { _v=[o[val] - 1], _set = &(obj) }
end)
terra set:sz()
var ct: intptr = 0
--for i = 0, [math.floor(#tbl/8)] do
-- ct = ct + lib.math.ll.ctpop_u8(self._store[i])
--end
--[(function()
-- if #tbl % 8 ~= 0 then
|
|
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
set.idvmap = o
set.null = quote var s: set s:clear() in s end
set.name = string.format('set<%s>', table.concat(tbl, '|'))
set.metamethods.__entrymissing = macro(function(val, obj)
if o[val] == nil then error('value ' .. val .. ' not in set') end
return `bit { _v=[o[val] - 1], _set = &(obj) }
end)
terra set:any()
for i = 0, bytes - 1 do
if self._store[i] ~= 0 then return true end
end
return false
end
terra set:sz()
var ct: intptr = 0
--for i = 0, [math.floor(#tbl/8)] do
-- ct = ct + lib.math.ll.ctpop_u8(self._store[i])
--end
--[(function()
-- if #tbl % 8 ~= 0 then
|