Implement byte?.
authorChris Hanson <org/chris-hanson/cph>
Thu, 5 Jan 2017 20:06:15 +0000 (12:06 -0800)
committerChris Hanson <org/chris-hanson/cph>
Thu, 5 Jan 2017 20:06:15 +0000 (12:06 -0800)
src/runtime/bytevector.scm
src/runtime/runtime.pkg

index e39d1409fb18ffa1e06f37cdbd1dbddcf14fa3fc..80e10409680899a1d1ae822a56b8c11bbd9373dc 100644 (file)
@@ -28,6 +28,12 @@ USA.
 
 (declare (usual-integrations))
 \f
+(define (byte? object)
+  (and (index-fixnum? object)
+       (fix:< object #x100)))
+
+(define-guarantee byte "byte")
+
 (define-primitives
   (allocate-bytevector 1)
   (bytevector-fill! 4)
index 987e4fcfc77f5b047f13e4fbe33aab83dccb9368..50c1a900dffb1735b83c96a7c7d53c502abdad87 100644 (file)
@@ -1122,6 +1122,7 @@ USA.
   (files "bytevector")
   (parent (runtime))
   (export ()
+         byte?
          bytevector
          bytevector-append
          bytevector-copy
@@ -1130,6 +1131,7 @@ USA.
          bytevector-u8-ref
          bytevector-u8-set!
          bytevector?
+         guarantee-byte
          guarantee-bytevector
          make-bytevector
          string->utf8