Lisp HUG Maillist Archive

how to determine the Lispworks number of bits (32 or 64)?

I have just installed Lispworks (64-bits) and we want to compare performance of the two platforms. I have coded the following to be platform independent and robust. Is there a better way to do this (determine the size in bits of the runtime)?

 

(defun fixnum-bits ()

  (let ((bits (floor (log most-positive-fixnum 2))))

    (if (< bits 32)

        32

      (if (< bits 64)

          64

        128))))

 

Sent from Mail for Windows 10

 

Re: how to determine the Lispworks number of bits (32 or 64)?

Looks like this is available via *features*, so something like 

(defvar *num-bits* #+lispworks-32bit 32 #+lispworks-64bit 64)

should work... or possibly/preferably just use #+lispworks-32bit / #+lispworks-64bit as needed.

Note that fixnum-bits is exactly 

(floor (log (- most-positive-fixnum most-negative-fixnum) 2))

This is different from the architecture word size.

See also http://www.lispworks.com/documentation/lw71/LW/html/lw-233.htm#pgfId-891709


On Fri, Jul 26, 2019 at 7:48 AM roy anderson <reanz1959@gmail.com> wrote:

I have just installed Lispworks (64-bits) and we want to compare performance of the two platforms. I have coded the following to be platform independent and robust. Is there a better way to do this (determine the size in bits of the runtime)?

 

(defun fixnum-bits ()

  (let ((bits (floor (log most-positive-fixnum 2))))

    (if (< bits 32)

        32

      (if (< bits 64)

          64

        128))))

 

Sent from Mail for Windows 10

 

Updated at: 2020-12-10 08:29 UTC