[plt-scheme] Bit manipulation in PLT Scheme

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Fri Mar 10 18:41:31 EST 2006

Paulo J. Matos wrote:

> Thanks for the reference, I took a 'flash' look  through the source
> code of md5.ss and I was expecting it to implement in someway the
> 32bit word vectors using low-level access to C but it doesn't seem so.
> Instead it seems to be using numbers < 655...
> (define-syntax word
>   (syntax-rules ()
>     [(word c)
>      (cons (quotient c 65536) (remainder c 65536))]))
> My doubt is, isn't any number represented in MzScheme interpreted as a
> big num be it either 1, 2 or 324234928340928343123? Or MzScheme is
> able internally to represent  30000 inside an int since it checks
> there is no need for a bignum?

A search for "fixnum" in the HelpDesk reveals that fixnums are 30 bits
plus a sign bit.

Since the md5 algorithm works on 32 bits, the words in m5.ss has to
use 2 fixnums in a word.

Jens Axel Søgaard

Posted on the users mailing list.