UIBytes.st
author claus
Wed, 13 Oct 1993 01:19:00 +0100
changeset 3 24d81bf47225
parent 1 a27a279701f8
child 63 1f0cdefb013f
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 1993 by Claus Gittinger
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

ByteArray subclass:#UninterpretedBytes
       instanceVariableNames:''
       classVariableNames:''
       poolDictionaries:''
       category:'System-Support'
!

UninterpretedBytes comment:'

COPYRIGHT (c) 1993 by Claus Gittinger
              All Rights Reserved

this class has been added for ST-80 compatibility.

$Header: /cvs/stx/stx/libbasic/Attic/UIBytes.st,v 1.3 1993-10-13 00:18:47 claus Exp $
'!

!UninterpretedBytes class methodsFor:'queries'!

isBigEndian
    "return true, if words/shorts store the most-significant
     byte last. I.e. true if LSB-first (vax, intel), 
     false if MSB-first (m68k, sun)."

%{  /* NOCONTEXT */

    /*
     * I dont like ifdefs - you always forget some ...
     * therefore we look into a structure at run-time
     */
    union {
        unsigned int   u_l;
        char           u_c[sizeof(int)];
    } u;

    u.u_l = 0x87654321;
    if (u.u_c[0] == 0x21) RETURN (true);
    RETURN (false );
%}
    "UninterpretedBytes isBigEndian"
! !

!UninterpretedBytes methodsFor:'accessing'!

byteAt:index
    ^ self basicAt:index
!

byteAt:index put:value
    ^ self basicAt:index put:value
! !