Changes between Version 14 and Version 15 of BitwiseCowan
 Timestamp:
 09/14/16 08:57:14 (8 months ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

BitwiseCowan
v14 v15 66 66 * These operations interpret exact integers using two'scomplement representation. 67 67 68 * It is not optional for the associative bitwise ops to be nary instead of merely binary. Theyare required to be nary. Programmers can ''reliably'' write `bitwiseand` with 3 arguments, for example.68 * The associative bitwise ops are required to be nary. Programmers can ''reliably'' write `bitwiseand` with 3 arguments, for example. 69 69 70 70 * The word `or` is never used by itself, only with modifiers: `xor`, `ior`, `nor`, … … 107 107 108 108 * "load" and "deposit" are the wrong verbs (e.g., Common Lisp's `ldb` and `dpb` ops), 109 since the se guyshave nothing to do with the store.109 since they have nothing to do with the store. 110 110 111 111 * `boole` has been removed; it is not one with the Way of Scheme. Boolean functions … … 152 152 === Other sources === 153 153 154 The following procedures are inspired by SRFI 133: `bitswap`, `bitfieldappend`,154 * The following procedures are inspired by SRFI 133: `bitswap`, `bitfieldappend`, 155 155 `bitwisefold`, `bitwiseforeach`, `bitwiseunfold`. 156 156 … … 171 171 size of the field. SRFI 33 bitfield operations had leading ''position'' and ''size'' 172 172 arguments instead. These 173 have been replaced in this SRFI by ''start'' (inclusive) and ''end'' (exclusive)173 have been replaced in this SRFI by trailing ''start'' (inclusive) and ''end'' (exclusive) 174 174 arguments, the convention used not only in SRFI 60 and R6RS but also in most other 175 175 subsequence operations in Scheme standards and SRFIs. … … 205 205 the corresponding bitwise operator 206 206 maps that function across a pair of bitstrings in a bitwise fashion. 207 208 207 The core idea of this group of functions is this bitwise "lifting" 209 208 of the set of dyadic boolean functions to bitstring parameters. … … 302 301 303 302 For nonnegative ''i'', this is the number of bits needed to 304 represent Iin an unsigned binary representation. For all ''i'',303 represent ''i'' in an unsigned binary representation. For all ''i'', 305 304 `(+ 1 (integerlength `''i''`))` is the number of bits needed 306 305 to represent ''i'' in a signed twoscomplement … … 370 369 371 370 Determines if any/all of the bits set in bitstring ''testbits'' are set 372 in bitstring ' i''. I.e., returns `(not (zero? (bitwiseand `''testbits i''`)))`371 in bitstring ''i''. I.e., returns `(not (zero? (bitwiseand `''testbits i''`)))` 373 372 or `(= `''testbits''` (bitwiseand ''testbits i'')))` respectively. 374 373 … … 376 375 377 376 Return the index of the first (smallest index) 1 bit in bitstring ''i''. 378 Return 1 if ''i'' contains no 1 bits (i.e., if Iis zero).377 Return 1 if ''i'' contains no 1 bits (i.e., if ''i'' is zero). 379 378 380 379 {{{ … … 398 397 `(bitfield `''i start end''`)` 399 398 400 Returns the designated bitfield from ''i'', shifted399 Returns the field from ''i'', shifted 401 400 down to the leastsignificant position in the result. 402 401 … … 412 411 `(bitfieldset `''i start end''`)` 413 412 414 Returns ''i'' with the selectedfield's bits set to all 0s/1s.413 Returns ''i'' with the field's bits set to all 0s/1s. 415 414 416 415 `(bitfieldreplace `''dst src start end''`)` 417 416 418 Returns ''dst'' with the designated bitfield replaced417 Returns ''dst'' with the field replaced 419 418 by the leastsignificant ''endstart'' bits in ''src''. 420 419 421 420 `(bitfieldreplacesame `''dst src start end''`)` 422 421 423 Returns ''dst'' with the selected field's bitsreplaced424 by the corresponding field 's bitsin ''src''.422 Returns ''dst'' with its field replaced 423 by the corresponding field in ''src''. 425 424 426 425 `(bitfieldrotate `''i count start end''`)` 427 426 428 Returns ''i'' with the selectedfield cyclically permuted427 Returns ''i'' with the field cyclically permuted 429 428 by ''count'' bits towards highorder. 430 429 431 430 `(bitfieldreverse `''i start end''`)` 432 431 433 Returns ''i'' with the order of the bits in the selectedfield reversed.432 Returns ''i'' with the order of the bits in the field reversed. 434 433 435 434 `(bitfieldappend `''i start end'' ...`)` … … 445 444 446 445 Returns a list/vector of ''len'' booleans corresponding to each bit of the nonnegative integer ''i''. 447 `#t` is returned for each 1; `#f` for 0. The lenargument defaults to `(integerlength `''i''`)`.446 `#t` is returned for each 1; `#f` for 0. The ''len'' argument defaults to `(integerlength `''i''`)`. 448 447 449 448 `(list>integer `''list''`)`[[BR]] … … 486 485 (whose initial value is ''seed'') is true, return the 487 486 currently accumulated bits as an integer. Otherwise, apply ''mapper'' 488 to the current state to obtain the next bit of the result. Then get a new state 487 to the current state to obtain the next bit of the result by interpreting 488 a true value as a 1 bit and a false value as a 0 bit. Then get a new state 489 489 by applying ''successor'' to the current state, and repeat this algorithm. 490 490 … … 525 525 Test bit field (every)`bitfieldevery?``bitfieldevery?` 526 526 Clear bit field`maskfield``clearbitfield``bitfieldclear``bitfieldclear` 527 Set bit field`bitfieldset` 527 528 Replace bit field`dpb``replacebitfield``bitfieldreplace``copybitfield``bitwisecopybitfield``bitfieldreplace` 528 529 Replace corresponding bit field`depositfield``depositfield``copybitfield``bitfieldcopysame` 529 Fill bit field`bitfieldfill`530 530 Rotate bit field`rotatebitfield``bitwiserotatebitfield``bitfieldrotate` 531 531 Reverse bit field`reversebitfield``bitwisereversebitfield``bitfieldreverse`