Skip to content

Commit e5c3f31

Browse files
authored
CIP-0122 | Typographical fixes & corrections (#864)
* Fix typoes in CIP-122 * Fix broken references to CIP-121 * Fix naming for bytestring indexing and length functions
1 parent 0e88735 commit e5c3f31

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

CIP-0122/README.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ to access individual bytes by index as a primitive operation. Thus, we can view
184184
a `BuiltinByteString` as an indexed collection of bytes; for any
185185
`BuiltinByteString` $b$ of length $n$, and any $i \in 0, 1, \ldots, n - 1$, we
186186
define $b\\{i\\}$ as the byte at index $i$ in $b$, as defined by the
187-
`builtinIndexByteString` primitive. In essence, for any `BuiltinByteString` of
187+
`indexByteString` primitive. In essence, for any `BuiltinByteString` of
188188
length `n`, we have _byte_ indexes as follows:
189189

190190
```
@@ -354,7 +354,7 @@ their lengths in bytes; see the
354354
for the exact specification of this. Let the result of `bitwiseLogicalAnd`, given
355355
$b_1, b_2$ and some padding semantics argument, be $b_r$, also of length $n$
356356
in bytes. We use $b_1\\{i\\}$ to refer to the byte at index $i$ in $b_1$ (and
357-
analogously for $b_2$, $b_r#); see the [section on the bit indexing
357+
analogously for $b_2$, $b_r$); see the [section on the bit indexing
358358
scheme](#bit-indexing-scheme) for the exact specification of this.
359359

360360
For all $i \in 0, 1, \ldots, n - 1$, we have
@@ -381,11 +381,11 @@ bitwiseLogicalAnd True [] [0xFF] => [0xFF]
381381
382382
bitwiseLogicalAnd True [0xFF] [] => [0xFF]
383383
384-
bitwiseLogicalAnd False [0xFF] [0x00] => [0x00]
384+
bitwiseLogicalAnd True [0xFF] [0x00] => [0x00]
385385
386-
bitwiseLogicalAnd False [0x00] [0xFF] => [0x00]
386+
bitwiseLogicalAnd True [0x00] [0xFF] => [0x00]
387387
388-
bitwiseLogicalAnd False [0x4F, 0x00] [0xF4] => [0x44, 0x00]
388+
bitwiseLogicalAnd True [0x4F, 0x00] [0xF4] => [0x44, 0x00]
389389
```
390390

391391
#### `bitwiseLogicalOr`
@@ -405,7 +405,7 @@ their lengths in bytes; see the
405405
for the exact specification of this. Let the result of `bitwiseLogicalOr`, given
406406
$b_1, b_2$ and some padding semantics argument, be $b_r$, also of length $n$
407407
in bytes. We use $b_1\\{i\\}$ to refer to the byte at index $i$ in $b_1$ (and
408-
analogously for $b_2$, $b_r#); see the [section on the bit indexing
408+
analogously for $b_2$, $b_r$); see the [section on the bit indexing
409409
scheme](#bit-indexing-scheme) for the exact specification of this.
410410

411411
For all $i \in 0, 1, \ldots, n - 1$, we have
@@ -429,11 +429,11 @@ bitwiseLogicalOr True [] [0xFF] => [0xFF]
429429
430430
bitwiseLogicalOr True [0xFF] [] => [0xFF]
431431
432-
bitwiseLogicalOr False [0xFF] [0x00] => [0xFF]
432+
bitwiseLogicalOr True [0xFF] [0x00] => [0xFF]
433433
434-
bitwiseLogicalOr False [0x00] [0xFF] => [0xFF]
434+
bitwiseLogicalOr True [0x00] [0xFF] => [0xFF]
435435
436-
bitwiseLogicalOr False [0x4F, 0x00] [0xF4] => [0xFF, 0x00]
436+
bitwiseLogicalOr True [0x4F, 0x00] [0xF4] => [0xFF, 0x00]
437437
```
438438

439439
#### `bitwiseLogicalXor`
@@ -453,7 +453,7 @@ their lengths in bytes; see the
453453
for the exact specification of this. Let the result of `bitwiseLogicalXor`, given
454454
$b_1, b_2$ and some padding semantics argument, be $b_r$, also of length $n$
455455
in bytes. We use $b_1\\{i\\}$ to refer to the byte at index $i$ in $b_1$ (and
456-
analogously for $b_2$, $b_r#); see the [section on the bit indexing
456+
analogously for $b_2$, $b_r$); see the [section on the bit indexing
457457
scheme](#bit-indexing-scheme) for the exact specification of this.
458458

459459
For all $i \in 0, 1, \ldots, n - 1$, we have
@@ -480,11 +480,11 @@ bitwiseLogicalOr True [] [0xFF] => [0xFF]
480480
481481
bitwiseLogicalOr True [0xFF] [] => [0xFF]
482482
483-
bitwiseLogicalOr False [0xFF] [0x00] => [0xFF]
483+
bitwiseLogicalOr True [0xFF] [0x00] => [0xFF]
484484
485-
bitwiseLogicalOr False [0x00] [0xFF] => [0xFF]
485+
bitwiseLogicalOr True [0x00] [0xFF] => [0xFF]
486486
487-
bitwiseLogicalOr False [0x4F, 0x00] [0xF4] => [0xBB, 0x00]
487+
bitwiseLogicalOr True [0x4F, 0x00] [0xF4] => [0xBB, 0x00]
488488
```
489489

490490
#### `bitwiseLogicalComplement`
@@ -526,7 +526,7 @@ bitwiseLogicalComplement [0x4F, 0xF4] => [0xB0, 0x0B]
526526
_index argument_.
527527

528528
Let $b$ refer to the data argument, of length $n$ in bytes, and let $i$ refer to
529-
the index argument. We use $b[i]$ to refer to the value at index $i$t of $b$; see
529+
the index argument. We use $b[i]$ to refer to the value at index $i$ of $b$; see
530530
the [section on the bit indexing scheme](#bit-indexing-scheme) for the exact
531531
specification of this.
532532

@@ -938,16 +938,16 @@ replicateByteString (n + m) w = replicateByteString n w <> replicateByteString m
938938
```
939939

940940
Additionally, for any 'in-bounds' index (that is, any index for which
941-
`builtinIndexByteString` won't error) `i`, we have
941+
`indexByteString` won't error) `i`, we have
942942

943943
```haskell
944-
builtinIndexByteString (replicateByteString n w) i = w
944+
indexByteString (replicateByteString n w) i = w
945945
```
946946

947947
Lastly, we have
948948

949949
```haskell
950-
builtinSizeOfByteString (replicateByteString n w) = n
950+
lengthByteString (replicateByteString n w) = n
951951
```
952952

953953
## Rationale: how does this CIP achieve its goals?
@@ -1522,7 +1522,7 @@ This CIP is licensed under [Apache-2.0](http://www.apache.org/licenses/LICENSE-2
15221522
[cip-58]: https://github.com/cardano-foundation/CIPs/tree/master/CIP-0058
15231523
[croaring]: https://github.com/RoaringBitmap/CRoaring
15241524
[too-many-ways-1]: https://fgiesen.wordpress.com/2018/02/19/reading-bits-in-far-too-many-ways-part-1
1525-
[conversion-cip]: https://github.com/mlabs-haskell/CIPs/blob/koz/to-from-bytestring/CIP-0121/README.md
1525+
[conversion-cip]: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0121/README.md
15261526
[benchmarks-bits]: https://github.com/mlabs-haskell/plutus-integer-bytestring/blob/main/bench/naive/Main.hs#L74-L83
15271527
[vector]: https://hackage.haskell.org/package/vector-0.13.1.0/docs/Data-Vector.html#v:-47--47-
15281528
[boolean-algebra-2]: https://en.wikipedia.org/wiki/Two-element_Boolean_algebra
@@ -1531,7 +1531,8 @@ This CIP is licensed under [Apache-2.0](http://www.apache.org/licenses/LICENSE-2
15311531
[blake2b]: https://en.wikipedia.org/wiki/BLAKE_(hash_function)
15321532
[argon2]: https://en.wikipedia.org/wiki/Argon2
15331533
[xor-crypto]: https://en.wikipedia.org/wiki/Exclusive_or#Bitwise_operation
1534-
[cip-121-big-endian]: https://github.com/mlabs-haskell/CIPs/blob/koz/to-from-bytestring/CIP-0121/README.md#representation
1534+
[cip-121]: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0121/README.md
1535+
[cip-121-big-endian]:https://github.com/cardano-foundation/CIPs/blob/master/CIP-0121/README.md/#representation
15351536
[bitwise-and]: https://en.wikipedia.org/wiki/Bitwise_operation#AND
15361537
[bitwise-or]: https://en.wikipedia.org/wiki/Bitwise_operation#OR
15371538
[bitwise-xor]: https://en.wikipedia.org/wiki/Bitwise_operation#XOR

0 commit comments

Comments
 (0)