diff options
Diffstat (limited to 'other/openssh-2.1.1p4/getput.h')
| -rw-r--r-- | other/openssh-2.1.1p4/getput.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/other/openssh-2.1.1p4/getput.h b/other/openssh-2.1.1p4/getput.h new file mode 100644 index 0000000..5f6b141 --- /dev/null +++ b/other/openssh-2.1.1p4/getput.h | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * getput.h | ||
| 4 | * | ||
| 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | ||
| 6 | * | ||
| 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | ||
| 8 | * All rights reserved | ||
| 9 | * | ||
| 10 | * Created: Wed Jun 28 22:36:30 1995 ylo | ||
| 11 | * | ||
| 12 | * Macros for storing and retrieving data in msb first and lsb first order. | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | /* RCSID("$OpenBSD: getput.h,v 1.4 2000/06/20 01:39:41 markus Exp $"); */ | ||
| 17 | |||
| 18 | #ifndef GETPUT_H | ||
| 19 | #define GETPUT_H | ||
| 20 | |||
| 21 | /*------------ macros for storing/extracting msb first words -------------*/ | ||
| 22 | |||
| 23 | #define GET_32BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 24) | \ | ||
| 24 | ((unsigned long)(unsigned char)(cp)[1] << 16) | \ | ||
| 25 | ((unsigned long)(unsigned char)(cp)[2] << 8) | \ | ||
| 26 | ((unsigned long)(unsigned char)(cp)[3])) | ||
| 27 | |||
| 28 | #define GET_16BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 8) | \ | ||
| 29 | ((unsigned long)(unsigned char)(cp)[1])) | ||
| 30 | |||
| 31 | #define PUT_32BIT(cp, value) do { \ | ||
| 32 | (cp)[0] = (value) >> 24; \ | ||
| 33 | (cp)[1] = (value) >> 16; \ | ||
| 34 | (cp)[2] = (value) >> 8; \ | ||
| 35 | (cp)[3] = (value); } while (0) | ||
| 36 | |||
| 37 | #define PUT_16BIT(cp, value) do { \ | ||
| 38 | (cp)[0] = (value) >> 8; \ | ||
| 39 | (cp)[1] = (value); } while (0) | ||
| 40 | |||
| 41 | /*------------ macros for storing/extracting lsb first words -------------*/ | ||
| 42 | |||
| 43 | #define GET_32BIT_LSB_FIRST(cp) \ | ||
| 44 | (((unsigned long)(unsigned char)(cp)[0]) | \ | ||
| 45 | ((unsigned long)(unsigned char)(cp)[1] << 8) | \ | ||
| 46 | ((unsigned long)(unsigned char)(cp)[2] << 16) | \ | ||
| 47 | ((unsigned long)(unsigned char)(cp)[3] << 24)) | ||
| 48 | |||
| 49 | #define GET_16BIT_LSB_FIRST(cp) \ | ||
| 50 | (((unsigned long)(unsigned char)(cp)[0]) | \ | ||
| 51 | ((unsigned long)(unsigned char)(cp)[1] << 8)) | ||
| 52 | |||
| 53 | #define PUT_32BIT_LSB_FIRST(cp, value) do { \ | ||
| 54 | (cp)[0] = (value); \ | ||
| 55 | (cp)[1] = (value) >> 8; \ | ||
| 56 | (cp)[2] = (value) >> 16; \ | ||
| 57 | (cp)[3] = (value) >> 24; } while (0) | ||
| 58 | |||
| 59 | #define PUT_16BIT_LSB_FIRST(cp, value) do { \ | ||
| 60 | (cp)[0] = (value); \ | ||
| 61 | (cp)[1] = (value) >> 8; } while (0) | ||
| 62 | |||
| 63 | #endif /* GETPUT_H */ | ||
