Lines Matching refs:bitwise

3 (library (tests r6rs arithmetic bitwise)
4 (export run-arithmetic-bitwise-tests)
12 (bitwise-not ei)
14 (bitwise-arithmetic-shift bits -1)))
19 [(_ n) (test (bitwise-length n)
24 (let ([c (count-bits (bitwise-arithmetic-shift-right n 1))])
29 (bitwise-not (pos-count-bits (bitwise-not n)))))
33 (test (bitwise-bit-count n) (count-bits n))]))
35 (define (run-arithmetic-bitwise-tests)
37 (test (bitwise-first-bit-set 0) -1)
38 (test (bitwise-first-bit-set 1) 0)
39 (test (bitwise-first-bit-set -4) 2)
41 (test (bitwise-arithmetic-shift -6 -1) -3)
42 (test (bitwise-arithmetic-shift -5 -1) -3)
43 (test (bitwise-arithmetic-shift -4 -1) -2)
44 (test (bitwise-arithmetic-shift -3 -1) -2)
45 (test (bitwise-arithmetic-shift -2 -1) -1)
46 (test (bitwise-arithmetic-shift -1 -1) -1)
48 (test (bitwise-reverse-bit-field #b1010010 1 4) 88) ; #b1011000
225 (test (bitwise-not 12) -13)
226 (test (bitwise-not -12) 11)
227 (test (bitwise-not -1) 0)
228 (test (bitwise-not 0) -1)
229 (test (least-fixnum) (bitwise-not (greatest-fixnum)))
230 (test (greatest-fixnum) (bitwise-not (least-fixnum)))
232 (test (bitwise-not 38947389478348937489374)
234 (test (bitwise-not #xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
236 (test (bitwise-not -38947389478348937489375)
238 (test (bitwise-not #x-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
240 (test (bitwise-not #xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
242 (test (bitwise-not #x-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
244 (test (bitwise-not #x1000000000000000000000000)
246 (test (bitwise-not #x-1000000000000000000000000)
251 (test (bitwise-and (expt 2 100) 17) 0)
252 (test (bitwise-and (- (expt 2 100) 1) 17) 17)
253 (test (bitwise-and (- (expt 2 100) 1) (expt 2 90)) (expt 2 90))
255 (test (bitwise-xor (expt 2 100) 17) (bitwise-ior (expt 2 100) 17))
256 (test (bitwise-xor (- (expt 2 100) 1) 17) (- (expt 2 100) 18))
257 (test (bitwise-xor (- (expt 2 100) 1) (expt 2 90)) (- (expt 2 100) (expt 2 90) 1))
259 (test (bitwise-if (expt 2 100) -1 1) (+ (expt 2 100) 1))
260 (test (bitwise-if (expt 2 100) 1 1) 1)
261 (test (bitwise-if (expt 2 100) (- (expt 2 200) 1) 1) (+ (expt 2 100) 1))
263 (test (bitwise-bit-count (expt 2 300)) 1)
264 (test (bitwise-bit-count (- (expt 2 300) 1)) 300)
265 (test (bitwise-bit-count (- (expt 2 300))) -301)
267 (test (bitwise-length (expt 2 300)) 301)
268 (test (bitwise-length (- (expt 2 300) 1)) 300)
269 (test (bitwise-length (- (expt 2 300))) 300)
271 (test (bitwise-first-bit-set (expt 2 300)) 300)
272 (test (bitwise-first-bit-set (- (expt 2 300) 1)) 0)
274 (test (bitwise-bit-set? (expt 2 300) 300) #t)
275 (test (bitwise-bit-set? (expt 2 300) 0) #f)
276 (test (bitwise-bit-set? (- (expt 2 300) 1) 300) #f)
277 (test (bitwise-bit-set? (- (expt 2 300) 1) 299) #t)
278 (test (bitwise-bit-set? (- (expt 2 300) 1) 298) #t)
279 (test (bitwise-bit-set? (- (expt 2 300) 2) 0) #f)
280 (test (bitwise-bit-set? -1 300) #t)
281 (test (bitwise-bit-set? -1 0) #t)
282 (test (bitwise-bit-set? -2 0) #f)
284 (test (bitwise-copy-bit-field (expt 2 300) 300 302 0) 0)
285 (test (bitwise-copy-bit-field (expt 2 300) 300 302 1) (expt 2 300))
286 (test (bitwise-copy-bit-field (expt 2 300) 300 302 2) (expt 2 301))
287 (test (bitwise-copy-bit-field (expt 2 300) 300 302 3) (+ (expt 2 300)
290 (test (bitwise-arithmetic-shift (expt 2 300) 1) (expt 2 301))
291 (test (bitwise-arithmetic-shift (expt 2 300) -1) (expt 2 299))
292 (test (bitwise-arithmetic-shift (expt 2 300) 300) (expt 2 600))
293 (test (bitwise-arithmetic-shift (expt 2 300) -300) 1)
295 (test (bitwise-arithmetic-shift-left (expt 2 300) 1) (expt 2 301))
296 (test (bitwise-arithmetic-shift-right (expt 2 300) 1) (expt 2 299))
297 (test (bitwise-arithmetic-shift-left (expt 2 300) 300) (expt 2 600))
298 (test (bitwise-arithmetic-shift-right (expt 2 300) 300) 1)
300 (test (bitwise-rotate-bit-field (expt 2 300) 299 304 2) (expt 2 302))
301 (test (bitwise-rotate-bit-field (expt 2 300) 299 304 4) (expt 2 299))
303 (test (bitwise-reverse-bit-field (expt 2 300) 299 304) (expt 2 302))