Paste number 60613: portable bitwise-and

Paste number 60613: portable bitwise-and
Pasted by: foof
5 days, 1 hour ago
#scheme | Context in IRC logs
Paste contents:
Raw Source | XML | Display As
;; there are faster portable versions

(define (bitwise-and a b)
  (cond
    ((zero? a) 0)
    ((zero? b) 0)
    (else
     (+ (if (and (odd? a) (odd? b)) 1 0)
        (* 2 (bitwise-and (quotient a 2) (quotient b 2)))
)
)
)
)

This paste has no annotations.

Colorize as:
Show Line Numbers

Ads absolutely not by Google

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.