[m-rev.] diff: add stream writer instances for 64-bit ints

Julien Fischer jfischer at opturion.com
Sun Mar 20 14:13:56 AEDT 2022


Also for the release branch.

----------------------------

Add stream writer instances for 64-bit ints.

library/io.m:
     As above.

Julien.

diff --git a/library/io.m b/library/io.m
index bae97c6..a4f7501 100644
--- a/library/io.m
+++ b/library/io.m
@@ -2068,13 +2068,14 @@
  :- instance stream.writer(text_output_stream, int8,   io).
  :- instance stream.writer(text_output_stream, int16,  io).
  :- instance stream.writer(text_output_stream, int32,  io).
+:- instance stream.writer(text_output_stream, int64,  io).
  :- instance stream.writer(text_output_stream, uint,   io).
  :- instance stream.writer(text_output_stream, uint8,  io).
  :- instance stream.writer(text_output_stream, uint16, io).
  :- instance stream.writer(text_output_stream, uint32, io).
+:- instance stream.writer(text_output_stream, uint64, io).
  :- instance stream.writer(text_output_stream, string, io).
  :- instance stream.writer(text_output_stream, univ,   io).
-% XXX IO_INSTANCE no instances fo {int,uint}64

  % Binary output stream instances.
  :- instance stream.stream(binary_output_stream, io).
@@ -5359,6 +5360,12 @@ restore_output_stream(_DummyPred, Stream, ok, !IO) :-
      pred(put/4) is write_int32
  ].

+:- instance stream.writer(text_output_stream, int64, io)
+    where
+[
+    pred(put/4) is write_int64
+].
+
  :- instance stream.writer(text_output_stream, uint, io)
      where
  [
@@ -5383,6 +5390,12 @@ restore_output_stream(_DummyPred, Stream, ok, !IO) :-
      pred(put/4) is write_uint32
  ].

+:- instance stream.writer(text_output_stream, uint64, io)
+    where
+[
+    pred(put/4) is write_uint64
+].
+
  :- instance stream.writer(text_output_stream, string, io)
      where
  [


More information about the reviews mailing list