Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Check if all 256 bits are clear or set ?
Date: Sun, 07 Nov 2021 08:12:16 -0800
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <86ee7saqsf.fsf@linuxsc.com>
References: <87fssdh302.fsf@bsb.me.uk> <37fh5i-t92.ln1@aretha.foo> <87ilx5a6nf.fsf@bsb.me.uk> <86r1bsc4b7.fsf@linuxsc.com> <87fss86d5g.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="2dc722b95f3891b2f37c442b9fb0adbf"; logging-data="7671"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9oiWOB9r4urYLCzH6DANWH9Tdp7qrbMI="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:21dmjJaK79Pl0XYvDBTBhBec8is= sha1:8vxeTAdH62jO5yydhApcm2X4A8M=
Xref: csiph.com comp.lang.c:163330
Ben Bacarisse writes:
> Tim Rentsch writes:
>
>> Ben Bacarisse writes:
>>
>>> i = 0;
>>> while (i < n && (unsigned char)~0U == data[i]) i++;
>>> // i >= n or data[i] != -1
>>> if (i < n)
>>> // data[i] != -1
>>> clrset ^= ALL_SET;
>>>
>>> i = 0;
>>> while (i < n && 0 == data[i]) i++;
>>> // i >= n or data[i] != 0
>>> if (i < n)
>>> // data[i] != 0
>>> clrset ^= ALL_CLEAR;
>
> For the record, not what I would write! [...]
I never assumed otherwise. I was just having fun
with the code.