Mercurial > dropbear
comparison src/headers/tomcrypt_macros.h @ 210:4768b55c5240 libtomcrypt
propagate from branch 'au.asn.ucc.matt.ltc-orig' (head 33c416b902f1a44913d825bae7ad9a160f703ed3)
to branch 'au.asn.ucc.matt.dropbear.ltc' (head 4d6aec6e6121e13f68c11c149b6579c41cb63e74)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 06 Jul 2005 12:10:23 +0000 |
parents | 39d5d58461d6 |
children |
comparison
equal
deleted
inserted
replaced
199:8be64e2c86f4 | 210:4768b55c5240 |
---|---|
130 #endif | 130 #endif |
131 | 131 |
132 #ifdef ENDIAN_32BITWORD | 132 #ifdef ENDIAN_32BITWORD |
133 | 133 |
134 #define STORE32L(x, y) \ | 134 #define STORE32L(x, y) \ |
135 { unsigned long __t = (x); memcpy(y, &__t, 4); } | 135 { ulong32 __t = (x); memcpy(y, &__t, 4); } |
136 | 136 |
137 #define LOAD32L(x, y) \ | 137 #define LOAD32L(x, y) \ |
138 memcpy(&(x), y, 4); | 138 memcpy(&(x), y, 4); |
139 | 139 |
140 #define STORE64L(x, y) \ | 140 #define STORE64L(x, y) \ |
150 (((ulong64)((y)[1] & 255))<<8)|(((ulong64)((y)[0] & 255))); } | 150 (((ulong64)((y)[1] & 255))<<8)|(((ulong64)((y)[0] & 255))); } |
151 | 151 |
152 #else /* 64-bit words then */ | 152 #else /* 64-bit words then */ |
153 | 153 |
154 #define STORE32L(x, y) \ | 154 #define STORE32L(x, y) \ |
155 { unsigned long __t = (x); memcpy(y, &__t, 4); } | 155 { ulong32 __t = (x); memcpy(y, &__t, 4); } |
156 | 156 |
157 #define LOAD32L(x, y) \ | 157 #define LOAD32L(x, y) \ |
158 { memcpy(&(x), y, 4); x &= 0xFFFFFFFF; } | 158 { memcpy(&(x), y, 4); x &= 0xFFFFFFFF; } |
159 | 159 |
160 #define STORE64L(x, y) \ | 160 #define STORE64L(x, y) \ |
191 (((ulong64)((y)[1] & 255))<<8)|(((ulong64)((y)[0] & 255))); } | 191 (((ulong64)((y)[1] & 255))<<8)|(((ulong64)((y)[0] & 255))); } |
192 | 192 |
193 #ifdef ENDIAN_32BITWORD | 193 #ifdef ENDIAN_32BITWORD |
194 | 194 |
195 #define STORE32H(x, y) \ | 195 #define STORE32H(x, y) \ |
196 { unsigned long __t = (x); memcpy(y, &__t, 4); } | 196 { ulong32 __t = (x); memcpy(y, &__t, 4); } |
197 | 197 |
198 #define LOAD32H(x, y) \ | 198 #define LOAD32H(x, y) \ |
199 memcpy(&(x), y, 4); | 199 memcpy(&(x), y, 4); |
200 | 200 |
201 #define STORE64H(x, y) \ | 201 #define STORE64H(x, y) \ |
211 (((ulong64)((y)[6] & 255))<<8)| (((ulong64)((y)[7] & 255))); } | 211 (((ulong64)((y)[6] & 255))<<8)| (((ulong64)((y)[7] & 255))); } |
212 | 212 |
213 #else /* 64-bit words then */ | 213 #else /* 64-bit words then */ |
214 | 214 |
215 #define STORE32H(x, y) \ | 215 #define STORE32H(x, y) \ |
216 { unsigned long __t = (x); memcpy(y, &__t, 4); } | 216 { ulong32 __t = (x); memcpy(y, &__t, 4); } |
217 | 217 |
218 #define LOAD32H(x, y) \ | 218 #define LOAD32H(x, y) \ |
219 { memcpy(&(x), y, 4); x &= 0xFFFFFFFF; } | 219 { memcpy(&(x), y, 4); x &= 0xFFFFFFFF; } |
220 | 220 |
221 #define STORE64H(x, y) \ | 221 #define STORE64H(x, y) \ |
369 #ifdef _MSC_VER | 369 #ifdef _MSC_VER |
370 #define byte(x, n) ((unsigned char)((x) >> (8 * (n)))) | 370 #define byte(x, n) ((unsigned char)((x) >> (8 * (n)))) |
371 #else | 371 #else |
372 #define byte(x, n) (((x) >> (8 * (n))) & 255) | 372 #define byte(x, n) (((x) >> (8 * (n))) & 255) |
373 #endif | 373 #endif |
374 | |
375 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_macros.h,v $ */ | |
376 /* $Revision: 1.7 $ */ | |
377 /* $Date: 2005/05/05 14:35:58 $ */ |