[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: put-byte vs. setf get-byte

>I occasionally do some low-level byte moves and so was interested
>to see Bill St. Clair post the following:
>(setf (%get-byte macptr p-offset) (aref array a-offset))
>Is this considered faster/better than:
>(%put-byte macptr (aref array a-offset) p-offset)

It's almost entirely a matter of taste. I happen to like using SETF because
it means that I don't have to remember where the new value goes in
the %PUT-xxx functions. The two expand into almost identical code, the only
difference being the switched order of evaluation of the offset and
new value args. The SETF form also returns the new value, whereas %PUT-BYTE
returns NIL.