mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 08:18:30 +00:00
Get rid of .internal.h convention in LIBC_INTRIN
This commit is contained in:
parent
0ed916ad5c
commit
86d884cce2
591 changed files with 773 additions and 773 deletions
27
libc/intrin/setjmp.h
Normal file
27
libc/intrin/setjmp.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_INTRIN_SETJMP_INTERNAL_H_
|
||||
#define COSMOPOLITAN_LIBC_INTRIN_SETJMP_INTERNAL_H_
|
||||
#include "libc/limits.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/**
|
||||
* Encodes nonzero number for longjmp().
|
||||
*
|
||||
* This is a workaround to the fact that the value has to be non-zero.
|
||||
* So we work around it by dedicating the highest bit to being a flag.
|
||||
*/
|
||||
static inline int EncodeLongjmp(int x) {
|
||||
return x | INT_MIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes nonzero number returned by setjmp().
|
||||
*
|
||||
* This is a workaround to the fact that the value has to be non-zero.
|
||||
* So we work around it by dedicating the highest bit to being a flag.
|
||||
*/
|
||||
static inline int DecodeSetjmp(int x) {
|
||||
return (int)((unsigned)x << 1) >> 1;
|
||||
}
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_INTRIN_SETJMP_INTERNAL_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue