From 6842876c9946cc96f4b879e95a5555f091a92b9a Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 5 Jan 2017 12:06:15 -0800 Subject: [PATCH] Implement byte?. --- src/runtime/bytevector.scm | 6 ++++++ src/runtime/runtime.pkg | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/runtime/bytevector.scm b/src/runtime/bytevector.scm index e39d1409f..80e104096 100644 --- a/src/runtime/bytevector.scm +++ b/src/runtime/bytevector.scm @@ -28,6 +28,12 @@ USA. (declare (usual-integrations)) +(define (byte? object) + (and (index-fixnum? object) + (fix:< object #x100))) + +(define-guarantee byte "byte") + (define-primitives (allocate-bytevector 1) (bytevector-fill! 4) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 987e4fcfc..50c1a900d 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -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 -- 2.25.1