272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
451
452
453
454
455
456
457
458
459
460
461
462
463
464
|
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, [#tbl] do
if (self._store[i/8] and (1 << i % 8)) ~= 0 then ct = ct + 1 end
end
return ct
end
set.methods.dump = macro(function(self)
local q = quote lib.io.say('dumping set:\n') end
................................................................................
'render:media-gallery';
'render:docpage';
'render:conf:profile';
'render:conf:sec';
'render:conf:users';
'render:conf';
'route';
}
do
local p = string.format('parsav: %s\nbuilt on %s\n', config.build.str, config.build.when)
terra version() lib.io.send(1, p, [#p]) end
|
|
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
...
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
|
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
-- local last = #tbl-1
-- local msk = (2 ^ (#tbl % 8)) - 1
-- return quote ct = ct + lib.math.ll.ctpop_u8(self._store[last] and [uint8](msk)) end
-- else return {} end
--end)()]
for i = 0, [#tbl] do
if (self._store[i/8] and (1 << i % 8)) ~= 0 then ct = ct + 1 end
end
return ct
end
set.methods.dump = macro(function(self)
local q = quote lib.io.say('dumping set:\n') end
................................................................................
'render:media-gallery';
'render:docpage';
'render:conf:profile';
'render:conf:sec';
'render:conf:users';
'render:conf:avi';
'render:conf';
'route';
}
do
local p = string.format('parsav: %s\nbuilt on %s\n', config.build.str, config.build.when)
terra version() lib.io.send(1, p, [#p]) end
|