From ce48dd1bca84dc88794256ec2b77430fd80b957c Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 13 Jun 2025 02:21:25 +0300 Subject: [PATCH] =?UTF-8?q?clear=20flags=20on=20=E2=80=A2bit.=5Fneg=20&=20?= =?UTF-8?q?=E2=80=A2bit.=5Fnot=20reuse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/sysfn.c | 4 ++-- test/cases/system.bqn | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index 1cd66e09..6dd0846e 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -1580,12 +1580,12 @@ B bitop1(B f, B x, enum BitOp1 op, char* name) { u8 rt = typeOfCast((CastType){ rw, 0 }); u64* xp = tyany_ptr(x); B r; u64* rp; - if (v(x)->refc!=1 || (rt==t_bitarr && IS_SLICE(TY(x)))) { + if (!reusable(x) || (rt==t_bitarr && IS_SLICE(TY(x)))) { Arr* ra = m_arr(offsetof(TyArr,a) + (n+7)/8, rt, n>>rws); arr_shCopyUnchecked(ra, x); r = taga(ra); rp = tyany_ptr(r); } else { - r = incG(x); rp = xp; + r = incG(REUSE(x)); rp = xp; } switch (op) { default: UD; case op_not: { diff --git a/test/cases/system.bqn b/test/cases/system.bqn index 377a1726..c85590f9 100644 --- a/test/cases/system.bqn +++ b/test/cases/system.bqn @@ -346,9 +346,9 @@ r←•MakeRand 1 ⋄ ! 1¨⊸≡ ∊{𝕊: 500 r.Deal 1000}¨ ↕4 !"•bit._cast: unsupported width 32 for type 'u'" % ⟨8,32‿'u'⟩•bit._cast 128⥊0 !"•bit._cast: unsupported width 1 for type 'i'" % ⟨8, 1‿'i'⟩•bit._cast 128⥊0 -%USE eqvar ⋄ {𝕊conv: {•internal.Keep 𝕩⍋1 ⋄ •internal.Validate conv •bit._cast 𝕩}_eqvar ↕64}¨ ≠´¨⊸/ ⥊ 8‿16‿32‿64 ⋈⌜ 1‿8‿16‿32‿64 -%USE eqvar ⋄ {𝕊conv: {•internal.Keep 𝕩⍒1 ⋄ •internal.Validate conv •bit._cast 𝕩}_eqvar ⌽↕64}¨ ≠´¨⊸/ ⥊ 8‿16‿32‿64 ⋈⌜ 1‿8‿16‿32‿64 -%USE eqvar ⋄ {𝕊conv: {•internal.Squeeze 𝕩 ⋄ •internal.Validate conv •bit._cast 𝕩}_eqvar 64↑2}¨ ≠´¨⊸/ ⥊ ⟨8⟩ ⋈⌜ 1‿8‿16‿32‿64 +%USE eqvar ⋄ {𝕊 f: {•internal.Keep 𝕩⍋1 ⋄ •internal.Validate F 𝕩}_eqvar ↕64}¨ ({𝕩•bit._neg}¨ 8‿16‿32‿64) ∾ {𝕩 •bit._cast}¨ ≠´¨⊸/ ⥊ 8‿16‿32‿64 ⋈⌜ 1‿8‿16‿32‿64 +%USE eqvar ⋄ {𝕊 f: {•internal.Keep 𝕩⍒1 ⋄ •internal.Validate F 𝕩}_eqvar ⌽↕64}¨ ({𝕩•bit._neg}¨ 8‿16‿32‿64) ∾ {𝕩 •bit._cast}¨ ≠´¨⊸/ ⥊ 8‿16‿32‿64 ⋈⌜ 1‿8‿16‿32‿64 +%USE eqvar ⋄ {𝕊 f: {•internal.Squeeze 𝕩 ⋄ •internal.Validate F 𝕩}_eqvar 64↑2}¨ ({𝕩•bit._neg}¨ 8‿16‿32‿64) ∾ {𝕩 •bit._cast}¨ ≠´¨⊸/ ⥊ ⟨8⟩ ⋈⌜ 1‿8‿16‿32‿64 # •platform Str ← {!=𝕩 ⋄ !×≠𝕩 ⋄ ! ∧´2=•Type¨𝕩} ⋄ Str •platform.os ⋄ Str •platform.cpu.arch ⋄ Str •platform.bqn.impl_version ⋄ Str •platform.environment