gugamilare <gugamilare@gmail.com> wrote:
+---------------
| Barry Margolin <bar...@alum.mit.edu> wrote:
| > Also, Common Lisp doesn't do modular arithmetic on UNSIGNED-BYTE, like C
| > does with unsigned.
|
| Someone correct me if I am wrong, but sbcl seems to be able to unbox
| values in local variables and optimize the use of (unsigned-byte 32).
+---------------
But *only* when its type inferencer -- plus the type promises your
declarations have made -- can *guarantee* that such optimized use
is valid. As Barry say, it *still* won't do modular arithmetic on
UNSIGNED-BYTE unless you lie to it and then declare (SAFETY 0) or
something. [Or unless you wrap each computation in (LOGAND ... #xffffffff),
or (MOD ... 4294967296) or equiv., whereupon it will feel free to allow
"wraparound" to happen and will cheerfully elide the LOGAND or MOD
from the generated code!]
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607