From 897027033e5f53dda9c0c1af56e29be0ae3bc8c5 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 14 Apr 2003 18:19:26 +0000 Subject: [PATCH] Implement HOST-BIG-ENDIAN?. --- v7/src/runtime/global.scm | 18 ++++++++++++++++-- v7/src/runtime/runtime.pkg | 3 ++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/v7/src/runtime/global.scm b/v7/src/runtime/global.scm index 6b795620c..0e54bedaa 100644 --- a/v7/src/runtime/global.scm +++ b/v7/src/runtime/global.scm @@ -1,8 +1,9 @@ #| -*-Scheme-*- -$Id: global.scm,v 14.59 2003/02/14 18:28:32 cph Exp $ +$Id: global.scm,v 14.60 2003/04/14 18:19:23 cph Exp $ -Copyright (c) 1988-2001 Massachusetts Institute of Technology +Copyright 1988,1989,1991,1992,1993,1995 Massachusetts Institute of Technology +Copyright 1998,2000,2001,2003 Massachusetts Institute of Technology This file is part of MIT/GNU Scheme. @@ -69,6 +70,19 @@ USA. (system-vector-length system-vector-size) system-vector-ref system-vector-set!) + +(define (host-big-endian?) + ;; Assumptions: + ;; * Word length is 32 or 64 bits. + ;; * Type codes are at most 8 bits. + ;; * Zero is a non-pointer type code. + (case (object-datum + (vector-ref (object-new-type (ucode-type vector) + "\000\001\002\000\000\003\004\000") + 1)) + ((#x00010200 #x0001020000030400) #t) + ((#x00020100 #x0004030000020100) #f) + (else (error "Unable to determine endianness of host.")))) ;;;; Potpourri diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index 23f58d1a9..e27c284fb 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.440 2003/03/21 17:51:09 cph Exp $ +$Id: runtime.pkg,v 14.441 2003/04/14 18:19:26 cph Exp $ Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology @@ -292,6 +292,7 @@ USA. hook/exit hook/quit hook/scode-eval + host-big-endian? hunk3-cons identity-procedure impurify -- 2.25.1