On Fri, Oct 6, 2023 at 4:41 AM Rob Landley <r...@landley.net> wrote:
>
> I could adjust _just_ addr to use unsigned long instead of unsigned long long,
> but I don't want two atollu()/atolu() and letting you do a longer address and
> silently truncating it isn't great either. Also, a 32-bit platform can't do an
> atomic 64 bit read/write either (it's gonna do 2 32 bit ones behind the 
> scenes)
> and I kinda don't want to claim it won't? Which means removing the 8 byte 
> option
> when building for 32 bits, which is trivial to do in the code:
>
> +    else if (sizeof(long)==8 && bytes==8) *(unsigned long *)p = data;


We can also emit an error earlier in the function if the WIDTH
parameter is 8 on a 32 bit platform.

IMO disallowing 64bit writes is less risky of headaches than silently
non-atomic behavior.  A clear error message might help alleviate the
documentation issue, but I'll agree it's less than ideal to find out
that something won't work after the fact.
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to