aboutsummaryrefslogtreecommitdiffhomepage
path: root/amd64
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-11 20:43:24 +0100
committerlemon <lsof@mailbox.org>2025-12-11 20:43:24 +0100
commit88652eeb10cd9381aafb2d55e9474bb0799630b1 (patch)
tree2ba02aa77ce8357e29ddb502aee18109a90bd136 /amd64
parent2bbdb7a6b8204ae3caa5235c4ba637834036a299 (diff)
rename arraylength macro -> countof
Diffstat (limited to 'amd64')
-rw-r--r--amd64/emit.c20
-rw-r--r--amd64/isel.c2
-rw-r--r--amd64/sysv.c2
3 files changed, 12 insertions, 12 deletions
diff --git a/amd64/emit.c b/amd64/emit.c
index e7dd724..fff73f0 100644
--- a/amd64/emit.c
+++ b/amd64/emit.c
@@ -449,12 +449,12 @@ encode(uchar **pcode, const struct desc *tab, int ntab, enum irclass k, struct o
}
}
-#define DEFINSTR1(X, ...) \
- static void \
- X(uchar **pcode, enum irclass k, struct oper oper) \
- { \
- static const struct desc tab[] = { __VA_ARGS__ }; \
- encode(pcode, tab, arraylength(tab), k, oper, mkoper(0,)); \
+#define DEFINSTR1(X, ...) \
+ static void \
+ X(uchar **pcode, enum irclass k, struct oper oper) \
+ { \
+ static const struct desc tab[] = { __VA_ARGS__ }; \
+ encode(pcode, tab, countof(tab), k, oper, mkoper(0,)); \
}
#define DEFINSTR2(X, ...) \
@@ -462,7 +462,7 @@ encode(uchar **pcode, const struct desc *tab, int ntab, enum irclass k, struct o
X(uchar **pcode, enum irclass k, struct oper dst, struct oper src) \
{ \
static const struct desc tab[] = { __VA_ARGS__ }; \
- encode(pcode, tab, arraylength(tab), k, dst, src); \
+ encode(pcode, tab, countof(tab), k, dst, src); \
}
DEFINSTR2(Xmovb,
@@ -500,7 +500,7 @@ static void Xmov(uchar **pcode, enum irclass k, struct oper dst, struct oper src
[KF32] = 7,
[KF64] = 10,
};
- encode(pcode, all + k2off[k], arraylength(all) - k2off[k], k, dst, src);
+ encode(pcode, all + k2off[k], countof(all) - k2off[k], k, dst, src);
}
DEFINSTR2(Xmovsxl,
{8, PGPR, PMEM, "\x63", EN_RM}, /* MOVSXD r64, m32 */
@@ -702,10 +702,10 @@ Ximul(uchar **pcode, enum irclass k, struct oper dst, struct oper s1, struct ope
}
assert(s2.t == OIMM);
if ((uint)(s2.imm + 128) < 256) {
- encode(pcode, imm8tab, arraylength(imm8tab), k, dst, s1);
+ encode(pcode, imm8tab, countof(imm8tab), k, dst, s1);
B(s2.imm);
} else {
- encode(pcode, imm32tab, arraylength(imm32tab), k, dst, s1);
+ encode(pcode, imm32tab, countof(imm32tab), k, dst, s1);
I32(s2.imm);
}
}
diff --git a/amd64/isel.c b/amd64/isel.c
index be2f769..77d5b9e 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -640,7 +640,7 @@ amd64_isel(struct function *fn)
for (i = 0; i < blk->ins.n; ++i) {
struct instr *ins = &instrtab[blk->ins.p[i]];
sel(fn, ins, blk, &i);
- if (ins->op < arraylength(opflags) && kisint(insrescls(*ins))) {
+ if (ins->op < countof(opflags) && kisint(insrescls(*ins))) {
if (opflags[ins->op] & ZF) iflagsrc = ins - instrtab;
else if (opflags[ins->op] & CLOBF) iflagsrc = -1;
}
diff --git a/amd64/sysv.c b/amd64/sysv.c
index 020f597..486c0c0 100644
--- a/amd64/sysv.c
+++ b/amd64/sysv.c
@@ -69,7 +69,7 @@ static int
abiarg(short r[2], uchar cls[2], uchar *r2off, int *ni, int *nf, int *ns, union irtype typ)
{
static const uchar intregs[] = { RDI, RSI, RDX, RCX, R8, R9 };
- enum { NINT = arraylength(intregs), NFLT = 8 };
+ enum { NINT = countof(intregs), NFLT = 8 };
int ret, ni_save, nf_save;
if (!typ.isagg) {