Rename ~+ to ~mod+; add ~mod-.

This commit is contained in:
Nigel Tao committed 2018-04-26 10:05:19 +10:00
1 parent de5bded395
commit a698b47cb6
11 files changed
+218 -206

No files matched your search

+2 -2
View File
@@ -214,7 +214,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader)()
}
if n_copied > 0 {
hlen -= n_copied
hdist = (hdist ~+ n_copied) & 0x7FFF
hdist = (hdist ~mod+ n_copied) & 0x7FFF
if hdist == 0 {
// Wrap around the this.history ringbuffer.
break
@@ -233,7 +233,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader)()
break
}
hlen -= n_copied
hdist = hdist ~+ n_copied
hdist ~mod+= n_copied
// TODO: "closed for writes" instead?
yield suspension "short write"
}
+1 -2
View File
@@ -96,8 +96,7 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
var z base.status = try this.flate.decode?(dst:in.dst, src:in.src)
if not this.ignore_checksum {
checksum_got = this.checksum.update(x:in.dst.since_mark())
decoded_length_got = decoded_length_got ~+
((in.dst.since_mark().length() & 0xFFFFFFFF) as base.u32)
decoded_length_got ~mod+= ((in.dst.since_mark().length() & 0xFFFFFFFF) as base.u32)
}
if z.is_ok() {
break
+2 -2
View File
@@ -33,8 +33,8 @@ pri func adler32.update(x slice base.u8)(checksum base.u32) {
}
iterate[8](p ptr base.u8:in.x) {
s1 ~+= deref p as base.u32
s2 ~+= s1
s1 ~mod+= deref p as base.u32
s2 ~mod+= s1
}
s1 %= 65521