Skip to content

Commit

Permalink
Fix IO
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwiyou committed Oct 2, 2023
1 parent 3edb6d1 commit 0dd32c4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/io.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ impl Reader {
c += (unsafe { self.cur.read() } - b'0') as u64;
self.cur = unsafe { self.cur.add(1) };
}
if unsafe { self.cur.read() } & 0x10 != 0 {
c *= 10;
c += (unsafe { self.cur.read() } - b'0') as u64;
self.cur = unsafe { self.cur.add(1) };
}
}
}
self.cur = unsafe { self.cur.add(1) };
Expand Down Expand Up @@ -338,7 +343,7 @@ impl Writer {
let mut hioff;
let looff;
if n >= 10_000_000_000_000_000 {
self.try_flush(19);
self.try_flush(20);
let mut hi = (n / 10_000_000_000_000_000) as u32;
let lo = n % 10_000_000_000_000_000;
let lohi = (lo / 100_000_000) as u32;
Expand All @@ -359,6 +364,11 @@ impl Writer {
hi /= 10;
hi128.0[hioff] = hi as u8 + b'0';
}
if hi >= 10 {
hioff -= 1;
hi /= 10;
hi128.0[hioff] = hi as u8 + b'0';
}
} else if n >= 100_000_000 {
self.try_flush(16);
let hi = (n / 100_000_000) as u32;
Expand Down

0 comments on commit 0dd32c4

Please sign in to comment.