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

Re: [Scheme-reports] Bitwise operations on bytes



 | From: Alan Watson <alan@x>
 | Date: Thu, 29 Mar 2012 12:25:41 -0600
 | 
 | > See <http://srfi.schemers.org/srfi-60/srfi-60.html>.  Bitwise
 | > operations on integers (both positive and negative) are well defined
 | > and implementable in pure R4RS using no more bits than the input
 | > numbers.
 | 
 | The implementation of SRFI-60 assumes two's complement binary representations:
 | 
 |   (define (lognot n) (- -1 n))

SRFI-60 implements 2's complement.  LOGNOT returns the same integer
whether running on 1's complement, 2's complement, sign-magnitude, or
BCD hardware (although it may require one more digit than its
argument).

 | However, in this context, the basic point that you can implement a
 | mapping from any finite domain in R4RS Scheme using a look-up table
 | remains valid.
 | 
 | Regards,
 | 
 | Alan

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports