[m-rev.] for review: putback of 8-bit values to binary input streams
Peter Wang
novalazy at gmail.com
Fri Oct 5 16:33:12 AEST 2018
On Fri, 5 Oct 2018 06:29:15 +0000 (UTC), Julien Fischer <jfischer at opturion.com> wrote:
> >> diff --git a/library/io.m b/library/io.m
> >> index 20af25a..b3356ff 100644
> >> --- a/library/io.m
> >> +++ b/library/io.m
> >> @@ -1014,6 +1014,20 @@
> >> :- pred putback_byte(io.binary_input_stream::in, int::in, io::di, io::uo)
> >> is det.
> >
> > The description for putback_byte itself does not describe the behaviour
> > for out-of-range values.
>
> It's supposed to be the bottom 8 bits of the int, which is what we say
> elsewhere for predicates that deal with "bytes". I've added sentence
> to that end.
Thanks.
> >> + % As above, but un-reads an int8 instead of a byte represented by
> >> + % the bottom 8 bits of an int.
> >> + %
> >> +:- pred putback_int8(int8::in, io::di, io::uo) is det.
> >> +:- pred putback_int8(io.binary_input_stream::in, int8::in, io::di, io::uo)
> >> + is det.
> >
> > The comment should be more specific, something like:
> >
> > Un-reads a byte, where the byte value is the 8 bits of the int8
> > reinterpreted as a uint8.
>
> How this?
>
> Like putback_byte, but where the byte value un-read is the 8 bits
> of the int8 reinterpreted as a uint8.
That's fine.
Peter
More information about the reviews
mailing list