| | 1 | /* $Header: d:/cvsroot/tads/TADS2/H_IX86.H,v 1.2 1999/05/17 02:52:12 MJRoberts Exp $ */ |
| | 2 | |
| | 3 | /* |
| | 4 | * Copyright (c) 1998, 2002 Michael J. Roberts. All Rights Reserved. |
| | 5 | * |
| | 6 | * Please see the accompanying license file, LICENSE.TXT, for information |
| | 7 | * on using and copying this software. |
| | 8 | */ |
| | 9 | /* |
| | 10 | Name |
| | 11 | h_ix86.h - hardware definitions for Intel x86. |
| | 12 | Function |
| | 13 | These definitions are for 16-bit and 32-bit Intel CPUs. Note that these |
| | 14 | probably will NOT work on 64-bit Intel hardware, because we assume that |
| | 15 | the largest type is 32 bits. |
| | 16 | Notes |
| | 17 | |
| | 18 | Modified |
| | 19 | 10/17/98 MJRoberts - Creation |
| | 20 | */ |
| | 21 | |
| | 22 | #ifndef H_IX86_H |
| | 23 | #define H_IX86_H |
| | 24 | |
| | 25 | /* round a size to worst-case alignment boundary */ |
| | 26 | #define osrndsz(s) (((s)+3) & ~3) |
| | 27 | |
| | 28 | /* round a pointer to worst-case alignment boundary */ |
| | 29 | #define osrndpt(p) ((uchar *)((((ulong)(p)) + 3) & ~3)) |
| | 30 | |
| | 31 | /* read unaligned portable unsigned 2-byte value, returning int */ |
| | 32 | #define osrp2(p) ((int)*(unsigned short *)(p)) |
| | 33 | |
| | 34 | /* read unaligned portable signed 2-byte value, returning int */ |
| | 35 | #define osrp2s(p) ((int)*(short *)(p)) |
| | 36 | |
| | 37 | /* write int to unaligned portable 2-byte value */ |
| | 38 | #define oswp2(p, i) (*(unsigned short *)(p)=(unsigned short)(i)) |
| | 39 | |
| | 40 | /* read unaligned portable 4-byte value, returning long */ |
| | 41 | #define osrp4(p) (*(long *)(p)) |
| | 42 | |
| | 43 | /* write long to unaligned portable 4-byte value */ |
| | 44 | #define oswp4(p, l) (*(long *)(p)=(l)) |
| | 45 | |
| | 46 | |
| | 47 | #endif /* H_IX86_H */ |
| | 48 | |