fixes #3657 These functions are mostly not used by lean itself, but it does affect two occurrences of `ByteArray.toUInt64LE! <$> IO.getRandomBytes 8` which I left as is instead of switching them to use `toUInt64BE!` to preserve behavior; but they are random bytes anyway seeded by the OS so it's unlikely any use of them depending on particular values was sound to begin with. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
23 lines
547 B
Text
23 lines
547 B
Text
|
|
def tst : IO Unit :=
|
|
do
|
|
let bs := [1, 2, 3].toByteArray;
|
|
IO.println bs;
|
|
let bs := bs.push 4;
|
|
let bs := bs.set! 1 20;
|
|
IO.println bs;
|
|
let bs₁ := bs.set! 2 30;
|
|
IO.println bs₁;
|
|
IO.println bs;
|
|
IO.println bs.size;
|
|
IO.println (bs ++ bs);
|
|
IO.println (bs.extract 1 3);
|
|
pure ()
|
|
|
|
#eval tst
|
|
|
|
#eval "abcd".hash
|
|
#eval [97, 98, 99, 100].toByteArray.hash
|
|
|
|
#eval [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88].toByteArray.toUInt64LE! == 0x8877665544332211
|
|
#eval [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88].toByteArray.toUInt64BE! == 0x1122334455667788
|