raz / commit 597cec35

commit
597cec358f5b95e4e075751f5ba0978350d1b5d7
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
f1ef1ab0
CLZ, CTZ and POPCOUNT: counts of bits, as report 2026-10.36 has them

The built-ins CLZ(x), CTZ(x) and POPCOUNT(x): Sym enters them, Parse's
builtin reads them, and Item's countBits checks x (an unsigned integer
type, or a set for POPCOUNT; an untyped constant is refused, with help
to give it a type), folds a constant by countOf, in a constant too, or
has Gen count the bits. The result is an INT.

The code keeps to the baseline x86-64, which has no lzcnt, tzcnt or
popcnt, and the compiler doesn't ask which machine it is on.
Gen.countZeros makes CLZ by bsr and CTZ by bsf, through X64.bitScan,
on all 64 bits, since a narrow value's bits above its width are zero;
0, which neither finds a one in and says so by ZF, counts the width:

    bsr r, r; jnz L; mov r, -1; L: neg r; add r, w - 1     (CLZ)
    bsf r, r; jnz L; mov r, w; L:                          (CTZ)

Gen.popCount sums the ones as Bytes.count does, with no loop: each
two bits, then four, then each byte, in rax and rdx, and a multiply
by 0101...H adds the eight bytes into the top one, shifted down by 56.

Tests: conform/run/Count (each unsigned type at 0, 1, its top bit, all
ones and a mixed value; constants; a U32 wrapped to 0; counts beside
other values on the stack; sets); conform/err ClzUntyped, CtzSigned,
PopcountReal and ClzSet, their messages in test/msg. compiler.md, the
editors' built-in lists and CLAUDE.md's readings say so. Code lines
11,902 -> 11,997.

patch · log

19 files changed, +335 -7

CLAUDE.md modified +7 -0

@@ -343,3 +343,10 @@
343343 `MAX(U64)` and `MAX(UINT)`, above `high(I64)`, keep their type, as a
344344 hex literal above it is a `U64`. A `T` not an integer type is an
345345 error; `MAX(x)` of a variable is "x isn't a type".
346+- `CLZ(x)`, `CTZ(x)` and `POPCOUNT(x)` (report 2026-10.36) give an
347+ `INT`, a constant of one when `x` is. They use only baseline x86-64,
348+ no `lzcnt`, `tzcnt` or `popcnt`: `bsr` or `bsf` on all 64 bits (a
349+ narrow value's upper ones are zero), with `jnz` past setting the
350+ count of 0 to the width; `POPCOUNT` by `Bytes.count`'s sums of two,
351+ four and eight bits and a multiply by `0101...H`, in rax and rdx. A
352+ set's `POPCOUNT` counts its bits the same way.

conform/err/ClzSet.raz (history) added +9 -0

@@ -0,0 +1,9 @@
1+module ClzSet;
2+type Day = (mon, tue);
3+ Days = set of Day;
4+proc main*;
5+var n: INT; s: Days;
6+begin
7+ n := CLZ(s);
8+end;
9+end ClzSet.

conform/err/ClzUntyped.raz (history) added +7 -0

@@ -0,0 +1,7 @@
1+module ClzUntyped;
2+proc main*;
3+var n: INT;
4+begin
5+ n := CLZ(1);
6+end;
7+end ClzUntyped.

conform/err/CtzSigned.raz (history) added +7 -0

@@ -0,0 +1,7 @@
1+module CtzSigned;
2+proc main*;
3+var n: INT; x: I32;
4+begin
5+ n := CTZ(x);
6+end;
7+end CtzSigned.

conform/err/PopcountReal.raz (history) added +3 -0

@@ -0,0 +1,3 @@
1+module PopcountReal;
2+const N = POPCOUNT(1.5);
3+end PopcountReal.

conform/run/Count.expect (history) added +31 -0

@@ -0,0 +1,31 @@
1+8 8 0
2+7 0 1
3+0 7 1
4+0 0 8
5+2 3 2
6+16 16 0
7+15 0 1
8+0 15 1
9+0 0 16
10+4 8 4
11+32 32 0
12+31 0 1
13+0 31 1
14+0 0 32
15+15 8 2
16+64 64 0
17+63 0 1
18+0 63 1
19+0 0 64
20+0 4 8
21+64 64 0
22+63 0 1
23+0 63 1
24+0 0 64
25+21 41 2
26+63 3 8
27+3 40 64
28+15 8 0
29+32 32 0
30+1980
31+4 3 0

conform/run/Count.raz (history) added +73 -0

@@ -0,0 +1,73 @@
1+(* CLZ(x), CTZ(x) and POPCOUNT(x) count the bits of x (report section
2+ 6.1): of each unsigned type, at its own width, with 0 counting the
3+ whole width; of variables, of a value an operator wrapped, beside
4+ other values, and of constants, in a constant too; and POPCOUNT of a
5+ set. Each line is CLZ, CTZ and POPCOUNT of one value. *)
6+module Count;
7+import Out;
8+
9+type
10+ Day = (mon, tue, wed, thu, fri, sat, sun);
11+ Days = set of Day;
12+
13+const
14+ Top = CLZ(U64(1)); (* 63 *)
15+ Low = CTZ(U16(8)); (* 3 *)
16+ Ones = POPCOUNT(U32(0F0F0H)); (* 8 *)
17+ Week = POPCOUNT({mon, wed, sun}); (* 3 *)
18+ None = CLZ(U8(0)) + CTZ(U32(0)); (* 8 + 32 *)
19+
20+proc show(a, b, c: INT);
21+begin
22+ Out.int(a); Out.str(" "); Out.int(b); Out.str(" "); Out.int(c); Out.ln;
23+end;
24+
25+proc u8(x: U8);
26+begin
27+ show(CLZ(x), CTZ(x), POPCOUNT(x));
28+end;
29+
30+proc u16(x: U16);
31+begin
32+ show(CLZ(x), CTZ(x), POPCOUNT(x));
33+end;
34+
35+proc u32(x: U32);
36+begin
37+ show(CLZ(x), CTZ(x), POPCOUNT(x));
38+end;
39+
40+proc u64(x: U64);
41+begin
42+ show(CLZ(x), CTZ(x), POPCOUNT(x));
43+end;
44+
45+proc uint(x: UINT);
46+begin
47+ show(CLZ(x), CTZ(x), POPCOUNT(x));
48+end;
49+
50+proc main*;
51+var c: U32; d: U64; n: INT; s, none: Days;
52+begin
53+ u8(0); u8(1); u8(80H); u8(0FFH); u8(28H);
54+ u16(0); u16(1); u16(8000H); u16(0FFFFH); u16(0F00H);
55+ u32(0); u32(1); u32(80000000H); u32(0FFFFFFFFH); u32(10100H);
56+ u64(0); u64(1); u64(8000000000000000H); u64(0FFFFFFFFFFFFFFFFH); u64(0F0000000000000F0H);
57+ uint(0); uint(1); uint(UINT(1) shl 63); uint(UINT(0FFFFFFFFFFFFFFFFH)); uint(UINT(6) shl 40);
58+ (* constants *)
59+ show(Top, Low, Ones);
60+ show(Week, None, POPCOUNT(U64(0FFFFFFFFFFFFFFFFH)));
61+ show(CLZ(U16(1)), CTZ(U8(0)), POPCOUNT(U8(0)));
62+ (* a U32 that wrapped to 0 is 0, whatever the machine held above it *)
63+ c := 80000000H;
64+ show(CLZ(c + c), CTZ(c + c), POPCOUNT(c + c));
65+ (* beside other values on the stack *)
66+ d := 0F0H;
67+ n := 1000 + CLZ(d) * 10 + CTZ(d) * 100 + POPCOUNT(d) * (POPCOUNT(d) + 1);
68+ Out.int(n); Out.ln;
69+ s := {tue, thu, sat, sun};
70+ show(POPCOUNT(s), POPCOUNT(s - {sun}), POPCOUNT(none));
71+end;
72+
73+end Count.

doc/compiler.md (history) modified +38 -5

@@ -18,12 +18,12 @@
1818 |---|---|---|---|
1919 | `src/Diag.raz` | 422 | 324 | Messages: positions, source excerpts, colour, counts |
2020 | `src/Scan.raz` | 1,169 | 965 | Symbols, literals, comments, positions |
21-| `src/Sym.raz` | 718 | 576 | Types, objects, scopes, layout |
21+| `src/Sym.raz` | 721 | 579 | Types, objects, scopes, layout |
2222 | `src/Chunk.raz` | 363 | 279 | The compiled program: chunks, fixups, line notes |
23-| `src/X64.raz` | 1,584 | 1,304 | The instruction encoder, jumps within a procedure, the assembler |
24-| `src/Gen.raz` | 2,592 | 1,843 | The stack machine, for x86-64: values, operations, checks, calls, frames |
25-| `src/Item.raz` | 2,244 | 1,800 | Items: types, constants, variables, operators, conversions, calls |
26-| `src/Parse.raz` | 4,400 | 3,800 | Declarations, statements, expressions, built-ins, recovery, warnings |
23+| `src/X64.raz` | 1,605 | 1,318 | The instruction encoder, jumps within a procedure, the assembler |
24+| `src/Gen.raz` | 2,666 | 1,885 | The stack machine, for x86-64: values, operations, checks, calls, frames |
25+| `src/Item.raz` | 2,293 | 1,841 | Items: types, constants, variables, operators, conversions, calls |
26+| `src/Parse.raz` | 4,403 | 3,803 | Declarations, statements, expressions, built-ins, recovery, warnings |
2727 | `src/Link.raz` | 407 | 315 | Tree shaking, layout, patching, the places |
2828 | `src/Elf.raz` | 449 | 355 | Static and dynamic ELF, symbol table, line numbers |
2929 | `src/Raz.raz` | 418 | 333 | The command line |
@@ -1156,6 +1156,32 @@
11561156 x86 takes it modulo 32, or 64, and a byte's or a word's rotation then
11571157 goes round modulo 8 or 16 itself, the count modulo the width.
11581158
1159+The counts of bits, `CLZ`, `CTZ` and `POPCOUNT`, are made with what
1160+every x86-64 has, as `lzcnt`, `tzcnt` and `popcnt` came later and the
1161+compiler doesn't ask which machine it is on. As a narrow integer's
1162+bits above its width are zero, all of them count in 64 bits.
1163+`countZeros` makes `CLZ` from `bsr`, the place of the highest one bit,
1164+and `CTZ` from `bsf`, the place of the lowest; neither has a place to
1165+give for 0, which they say by the zero flag, and 0 counts the whole
1166+width. For a `U32`:
1167+
1168+ CLZ(x) CTZ(x)
1169+ bsr r, r bsf r, r
1170+ jnz L jnz L
1171+ mov r, -1 mov r, 32
1172+ L: neg r L:
1173+ add r, 31
1174+
1175+`popCount` adds up the ones as `lib/Bytes.raz`'s `count` does, with
1176+no loop: each two bits become the number of their ones, then each
1177+four, then each byte, and a multiplication by `0101...H` adds the
1178+eight bytes into the top one, in rax and rdx beside `x`'s register:
1179+
1180+ mov rax, r; shr rax, 1; mov rdx, 5555...H; and rax, rdx; sub r, rax
1181+ mov rax, r; shr rax, 2; mov rdx, 3333...H; and rax, rdx; and r, rdx; add r, rax
1182+ mov rax, r; shr rax, 4; add r, rax; mov rdx, 0F0F...H; and r, rdx
1183+ mov rdx, 0101...H; imul r, rdx; shr r, 56
1184+
11591185 Checks: `check` jumps, when the check fails, to code at the end of the
11601186 procedure (`endFails`), so that a check that holds is a jump not taken.
11611187 That code puts the values involved where `Rt.fail` wants them and calls
@@ -1644,6 +1670,13 @@
16441670 but for `MAX(U64)` and `MAX(UINT)`, which are above `high(I64)`, where
16451671 an untyped constant ends, and keep their type, as a hexadecimal number
16461672 above it is a `U64`.
1673+
1674+`CLZ(x)`, `CTZ(x)` and `POPCOUNT(x)` (report 2026-10.36) are Item's
1675+`countBits`, which refuses an `x` not of an unsigned type, or a set for
1676+`POPCOUNT`, and an untyped constant with help that says to give it a
1677+type, as `rotand` does; folds a constant by counting its bits one by one
1678+(`countOf`); or has `Gen.countZeros` or `Gen.popCount` count them. The
1679+result is an `INT`.
16471680
16481681 Two mismatches in `coerce` that people meet on the way to it, a slice
16491682 where its element's pointer is wanted and a pointer where a slice is,

editor/emacs/raz-mode.el (history) modified +2 -1

@@ -33,7 +33,8 @@
3333
3434 (defconst raz-builtins
3535 '("SIZE" "ADR" "LEN" "PTR" "NEW" "MSG" "SYSCALL" "FENCE" "CAS" "XCHG" "XADD"
36- "ARGC" "ARGV" "INC" "DEC" "COPY" "ROL" "ROR" "MIN" "MAX"))
36+ "ARGC" "ARGV" "INC" "DEC" "COPY" "ROL" "ROR" "MIN" "MAX"
37+ "CLZ" "CTZ" "POPCOUNT"))
3738
3839 (defvar raz-mode-syntax-table
3940 (let ((st (make-syntax-table)))

editor/vim/syntax/raz.vim (history) modified +1 -0

@@ -16,6 +16,7 @@
1616 syntax keyword razType I8 I16 I32 I64 INT UINT U8 U16 U32 U64 BOOL F32 F64 ERROR
1717 syntax keyword razBuiltin SIZE ADR LEN PTR NEW MSG SYSCALL FENCE CAS XCHG XADD
1818 syntax keyword razBuiltin ARGC ARGV INC DEC COPY ROL ROR MIN MAX
19+syntax keyword razBuiltin CLZ CTZ POPCOUNT
1920 syntax keyword razConstant true false nil
2021
2122 " 123, 0FFH, 1.5, 2.0E-3

src/Gen.raz modified +73 -0

@@ -1065,6 +1065,79 @@
10651065 stack[depth - 1].k := kWord;
10661066 end;
10671067
1068+(* CLZ, if leading, or CTZ of the unsigned integer of size bytes on top
1069+ (report section 6.1). bsr finds the place h of its highest one bit,
1070+ and the zeros above it are the width less 1 less h; bsf finds the
1071+ place of its lowest, which is the zeros below it. Neither finds a
1072+ place in 0, the one value with no one bit, and both say so by ZF:
1073+ then the count is the whole width, as if h were -1, or the lowest
1074+ one at the width. The bits above size bytes are zero, so a scan of
1075+ all 64 sees the value's own. The baseline x86-64 lacks lzcnt and
1076+ tzcnt, which would count 0 by themselves. For a U32:
1077+
1078+ bsr r, r bsf r, r
1079+ jnz L jnz L
1080+ mov r, -1 mov r, 32
1081+ L: neg r L:
1082+ add r, 31 *)
1083+proc countZeros*(leading: BOOL; size: INT);
1084+var r, w, L: INT;
1085+begin
1086+ r := top();
1087+ w := size * 8;
1088+ L := NoLabel;
1089+ X.bitScan(leading, r);
1090+ X.jcc(X.ccNE, L);
1091+ if leading then X.movRI(r, -1); else X.movRI(r, w); end;
1092+ X.fixLink(L);
1093+ if leading then
1094+ X.unary(3, r); (* neg *)
1095+ X.aluI(X.aluAdd, r, w - 1);
1096+ end;
1097+ stack[depth - 1].k := kWord;
1098+end;
1099+
1100+(* POPCOUNT of the integer or set on top (report section 6.1), counted
1101+ as lib/Bytes.raz counts bytes, without a loop: each two bits are
1102+ made the sum of their ones, then each four, then each byte, and a
1103+ multiplication by 0101...H adds the eight bytes' sums into the top
1104+ byte. The baseline x86-64 lacks popcnt. rax and rdx are
1105+ free between the stack machine's operations.
1106+
1107+ mov rax, r; shr rax, 1; mov rdx, 5555...H; and rax, rdx; sub r, rax
1108+ mov rax, r; shr rax, 2; mov rdx, 3333...H; and rax, rdx; and r, rdx; add r, rax
1109+ mov rax, r; shr rax, 4; add r, rax; mov rdx, 0F0F...H; and r, rdx
1110+ mov rdx, 0101...H; imul r, rdx; shr r, 56 *)
1111+proc popCount*;
1112+var r: INT;
1113+begin
1114+ r := top();
1115+ (* each two bits: their value less its upper bit, which is its ones *)
1116+ X.movRR(RAX, r);
1117+ X.shiftI(X.shShr, RAX, 1);
1118+ X.movRI(RDX, 5555555555555555H);
1119+ X.alu(X.aluAnd, RAX, RDX);
1120+ X.alu(X.aluSub, r, RAX);
1121+ (* each four bits: the sums of its two pairs *)
1122+ X.movRR(RAX, r);
1123+ X.shiftI(X.shShr, RAX, 2);
1124+ X.movRI(RDX, 3333333333333333H);
1125+ X.alu(X.aluAnd, RAX, RDX);
1126+ X.alu(X.aluAnd, r, RDX);
1127+ X.alu(X.aluAdd, r, RAX);
1128+ (* each byte: the sums of its two halves, at most 8, which fits four bits *)
1129+ X.movRR(RAX, r);
1130+ X.shiftI(X.shShr, RAX, 4);
1131+ X.alu(X.aluAdd, r, RAX);
1132+ X.movRI(RDX, 0F0F0F0F0F0F0F0FH);
1133+ X.alu(X.aluAnd, r, RDX);
1134+ (* the top byte of r times 0101...H is the sum of all eight *)
1135+ X.movRI(RDX, 0101010101010101H);
1136+ X.imul(r, RDX);
1137+ X.shiftI(X.shShr, r, 56);
1138+ stack[depth - 1].k := kWord;
1139+end;
1140+
10681141 (* The left op the right of the two values on top, as a BOOL *)
10691142 proc compare*(sy: Scan.Sym; k: Kind; signed: BOOL);
10701143 var f: BOOL; r, x, y, i: INT; v: I64; c: BOOL; m: X.Mem;

src/Item.raz (history) modified +49 -0

@@ -1560,6 +1560,55 @@
15601560 return nil;
15611561 end;
15621562
1563+(* CLZ, CTZ or POPCOUNT, which, of v, a value w bits wide, folded *)
1564+proc countOf(which: INT; v: U64; w: I64): I64;
1565+var n, i: I64;
1566+begin
1567+ n := 0;
1568+ if which = Sym.bPopcount then
1569+ for i := 0 to w - 1 do n := n + I64((v shr i) & 1); end;
1570+ elsif which = Sym.bClz then
1571+ while (n < w) and (((v shr (w - 1 - n)) & 1) = 0) do INC(n); end;
1572+ else
1573+ while (n < w) and (((v shr n) & 1) = 0) do INC(n); end;
1574+ end;
1575+ return n;
1576+end;
1577+
1578+(* CLZ(x), CTZ(x) or POPCOUNT(x), which: the zero bits of x above its
1579+ highest one, below its lowest, or its one bits, an INT (report
1580+ section 6.1). x is of an unsigned integer type, whose width is what
1581+ 0 counts, or for POPCOUNT a set; an untyped constant has no width.
1582+ Of a constant the count is folded. *)
1583+proc countBits*(var x: Item; which: INT): ERROR;
1584+var name, s: []U8; ok: BOOL;
1585+begin
1586+ if x.mode in {mType, mBuiltin, mNone, mCase, mStr} then return notValue(x); end;
1587+ if which = Sym.bClz then name := "CLZ"; elsif which = Sym.bCtz then name := "CTZ"; else name := "POPCOUNT"; end;
1588+ if which = Sym.bPopcount then
1589+ s := say2("{} needs an unsigned integer or a set, found {}", name, what(x));
1590+ else
1591+ s := say2("{} needs an unsigned integer, found {}", name, what(x));
1592+ end;
1593+ if x.typ = Sym.tConst then
1594+ return Scan.markHelp(x.pos, s,
1595+ say1("an untyped constant has no width to count in: give it a type, as in U32({})", Diag.source(x.pos)));
1596+ end;
1597+ ok := (x.typ^.form = Sym.fInt) and not x.typ^.signed;
1598+ if (x.typ^.form = Sym.fSet) and (which = Sym.bPopcount) then ok := true; end;
1599+ if not ok then return Scan.markAt(x.pos, s); end;
1600+ if x.mode = mConst then
1601+ makeConst(x, Sym.tInt, countOf(which, U64(x.val), bits(x.typ)));
1602+ return nil;
1603+ end;
1604+ try value(x);
1605+ if which = Sym.bPopcount then Gen.popCount(); else Gen.countZeros(which = Sym.bClz, intSize(x.typ)); end;
1606+ x.typ := Sym.tInt;
1607+ x.mode := mStack;
1608+ x.made := false; (* a built-in's result, not an operator's *)
1609+ return nil;
1610+end;
1611+
15631612 (* MIN(T), or MAX(T) if max: the smallest or the largest value of the
15641613 integer type t, an untyped constant (report section 6.1); p is where
15651614 T is written. MAX(U64) and MAX(UINT) are above high(I64), where the

src/Parse.raz (history) modified +3 -0

@@ -1106,6 +1106,9 @@
11061106 start := Scan.tokPos();
11071107 t := try parseType();
11081108 try Item.limit(x, t, which = Sym.bMax, Scan.spanFrom(start));
1109+ | Sym.bClz, Sym.bCtz, Sym.bPopcount:
1110+ try expression(x, nil);
1111+ try Item.countBits(x, which);
11091112 | Sym.bCopy:
11101113 try expression(x, nil);
11111114 try Item.copyDest(x);

src/Sym.raz (history) modified +4 -1

@@ -132,7 +132,7 @@
132132 bSize* = 0; bAdr* = 1; bLen* = 2; bNew* = 3; bMsg* = 4; bSyscall* = 5;
133133 bFence* = 6; bCas* = 7; bXchg* = 8; bXadd* = 9; bArgc* = 10; bArgv* = 11;
134134 bInc* = 12; bDec* = 13; bCopy* = 14; bPtr* = 15; bRol* = 16; bRor* = 17;
135- bMin* = 18; bMax* = 19;
135+ bMin* = 18; bMax* = 19; bClz* = 20; bCtz* = 21; bPopcount* = 22;
136136
137137 MaxDepth* = 64; (* scopes open at once *)
138138
@@ -715,4 +715,7 @@
715715 enter("ROR", oBuiltin, nil, bRor);
716716 enter("MIN", oBuiltin, nil, bMin);
717717 enter("MAX", oBuiltin, nil, bMax);
718+ enter("CLZ", oBuiltin, nil, bClz);
719+ enter("CTZ", oBuiltin, nil, bCtz);
720+ enter("POPCOUNT", oBuiltin, nil, bPopcount);
718721 end Sym.

src/X64.raz (history) modified +11 -0

@@ -533,6 +533,17 @@
533533 if n >= 0 then Chunk.put1(n); end;
534534 end;
535535
536+(* bsr r, r, if reverse, or bsf r, r: the place of r's highest, or
537+ lowest, one bit, 0F BD and 0F BC. ZF is set if r is 0, which has no
538+ one bit, and r is then left undefined. *)
539+proc bitScan*(reverse: BOOL; r: INT);
540+var opc: INT; name: []U8;
541+begin
542+ if reverse then opc := 0BD0FH; name := "bsr"; else opc := 0BC0FH; name := "bsf"; end;
543+ if listing then say(text2(name, rn(r), rn(r))); end;
544+ opR(0, true, opc, r, r, false);
545+end;
546+
536547 (* F7 /ext: 2 not, 3 neg, 6 div, 7 idiv *)
537548 proc unary*(ext, r: INT);
538549 begin

test/msg/ClzSet.err (history) added +4 -0

@@ -0,0 +1,4 @@
1+conform/err/ClzSet.raz:7:14: error: CLZ needs an unsigned integer, found Days
2+ 7 | n := CLZ(s);
3+ | ^
4+raz: 1 error

test/msg/ClzUntyped.err (history) added +5 -0

@@ -0,0 +1,5 @@
1+conform/err/ClzUntyped.raz:5:14: error: CLZ needs an unsigned integer, found 1
2+ 5 | n := CLZ(1);
3+ | ^
4+help: an untyped constant has no width to count in: give it a type, as in U32(1)
5+raz: 1 error

test/msg/CtzSigned.err (history) added +4 -0

@@ -0,0 +1,4 @@
1+conform/err/CtzSigned.raz:5:14: error: CTZ needs an unsigned integer, found I32
2+ 5 | n := CTZ(x);
3+ | ^
4+raz: 1 error

test/msg/PopcountReal.err (history) added +4 -0

@@ -0,0 +1,4 @@
1+conform/err/PopcountReal.raz:2:20: error: POPCOUNT needs an unsigned integer or a set, found 1.5
2+ 2 | const N = POPCOUNT(1.5);
3+ | ^^^
4+raz: 1 error