Mercurial > cgi-bin > hgwebdir.cgi > PR > PR_Implementations > PR__Univ > PR__leaf_impls > PR__leaf_impl__MC_sharedMem
view Services_Offered_by_PR/PR__longjmp_helpers.h @ 22:a4e5b5fb5e96
Something has gone incredibly wrong, longjmp_helpers weren't included,
as well as no longer being physically present on the disk; so it is rewritten.
Hopefully it was exactly as it is now
author | Philipe Louchtch |
---|---|
date | Sun, 22 Jun 2014 00:02:33 +0200 |
parents | |
children | fc9be4644b4a |
line source
1 /*
2 * File: PR__longjmp_helpers.h
3 * Author: Philipe Louchtch - de Raadt
4 *
5 * Created on June 21, 2014, 11:32 PM
6 */
8 #ifndef PR__LONGJMP_HELPERS_H
9 #define PR__LONGJMP_HELPERS_H
11 #include <assert.h>
13 // Using the low 4 bits for retVal, the rest is for coreNum
14 // So valid retVal values are 0-15
16 #define Longjmp__decode_retVal(__toDecode, __coreNum, __retVal) \
17 do { \
18 __retVal = __toDecode & 15; \
19 \
20 /* If retVal is zero, the decoded coreNum will be 0, */ \
21 /* so we need to test to prevent clobbering up coreNum */ \
22 if (__retVal > 0) { \
23 __coreNum = __toDecode >> 4; \
24 } \
25 } while(0)
27 #define Longjmp__encode_retVal(__output, __coreNum, __retVal) \
28 do { \
29 assert(__retVal < 16 && "retVal must be smaller than 16!"); \
30 __output = __coreNum << 4; \
31 __output += __retVal; \
32 } while(0)
35 #endif /* PR__LONGJMP_HELPERS_H */