[cffi-devel] finding out byte order

Tamas K Papp tpapp at Princeton.EDU
Sun Sep 2 14:28:07 UTC 2007


What is the recommended way find to the byte order of the platform
using CFFI?  Currently I am using the following:

(defun native-byte-order-lsb-p ()
  (with-foreign-object (x :uint32)
    (setf (mem-ref x :uint32) 1)
    (= (mem-ref x :uint8) 1)))

but it looks like a nasty hack.

Tamas



More information about the cffi-devel mailing list