Add Bits.all and rename Bits.zero to Bits.none
This commit is contained in:
parent
9c77622c7c
commit
3e1290efaf
@ -168,7 +168,8 @@ global_env() ->
|
|||||||
{["Bits", "intersection"], Fun([Bits, Bits], Bits)},
|
{["Bits", "intersection"], Fun([Bits, Bits], Bits)},
|
||||||
{["Bits", "union"], Fun([Bits, Bits], Bits)},
|
{["Bits", "union"], Fun([Bits, Bits], Bits)},
|
||||||
{["Bits", "difference"], Fun([Bits, Bits], Bits)},
|
{["Bits", "difference"], Fun([Bits, Bits], Bits)},
|
||||||
{["Bits", "zero"], Bits},
|
{["Bits", "none"], Bits},
|
||||||
|
{["Bits", "all"], Bits},
|
||||||
%% Conversion
|
%% Conversion
|
||||||
{["Int", "to_str"], Fun1(Int, String)},
|
{["Int", "to_str"], Fun1(Int, String)},
|
||||||
{["Address", "to_str"], Fun1(Address, String)}
|
{["Address", "to_str"], Fun1(Address, String)}
|
||||||
|
@ -368,8 +368,10 @@ ast_body(?qid_app(["Bits", Fun], Args, _, _), Icode)
|
|||||||
["intersection", A, B] -> And(A, B);
|
["intersection", A, B] -> And(A, B);
|
||||||
["difference", A, B] -> And(A, Neg(And(A, B)))
|
["difference", A, B] -> And(A, Neg(And(A, B)))
|
||||||
end;
|
end;
|
||||||
ast_body({qid, _, ["Bits", "zero"]}, _Icode) ->
|
ast_body({qid, _, ["Bits", "none"]}, _Icode) ->
|
||||||
#integer{ value = 0 };
|
#integer{ value = 0 };
|
||||||
|
ast_body({qid, _, ["Bits", "all"]}, _Icode) ->
|
||||||
|
#integer{ value = -1 };
|
||||||
ast_body(?qid_app(["Bits", "sum"], [Bits], _, _), Icode) ->
|
ast_body(?qid_app(["Bits", "sum"], [Bits], _, _), Icode) ->
|
||||||
builtin_call(popcount, [ast_body(Bits, Icode), #integer{ value = 0 }]);
|
builtin_call(popcount, [ast_body(Bits, Icode), #integer{ value = 0 }]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user