[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LOAD-BYTE etc, and order of bit numbering
- To: MOON at MIT-MC
- Subject: LOAD-BYTE etc, and order of bit numbering
- From: JONL at MIT-MC (Jon L White)
- Date: Tue, 4 Dec 79 14:35:00 GMT
- Cc: (BUG LISP) at MIT-MC, NIL-IMPLEMENTATION at MIT-MC
- Original-date: 4 DEC 1979 0935-EST
Date: 3 December 1979 22:46-EST
From: David A. Moon <MOON at MIT-MC>
Subject: LOAD-BYTE and DEPOSIT-BYTE
. . .
dependency is that the arithmetic value of a fixnum containing a
certain pattern of bits depends on the word length; if the bits were
numbered from right to left it would not depend, provided only that the
number of bits was small enough to fit in a word.
Yea, this is the critical point as to why one has to have LDB as well
as LOAD-BYTE, namely that for READ/PRINT purposes one would like to have
a word-size-independent means of representing "bytes" (if there is no I/O,
using integers, why would one care what the numerical value of a "byte" is?)
In NIL, we have the BITS data type, which is the preferred means for I/O
of bytes; only when converting from fixnums to BITS is there the ambiguity
of "scaling" and "ordering" (right-to-left, or left-to-right). Likely
this means that LOAD-BYTE will be used only in explicitly machine-dependent
code; there are no usages of it in the NIL system now (only in the maclisp
virtual-machine support), but rather we depend on the conversions from
BITS to integers and vice-versa.
By the bye, code is not made machine-independent merely by
using only machine-independent primitives - your whole machine may
be Godel'd into a bunch of numbers, to which you apply only standard
arithmetic primitives.