mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 15:27:36 +02:00
Issue #262 - Attempt to prevent undefined behavior
This commit is contained in:
parent
5c54f45234
commit
0d40488d2e
1 changed files with 10 additions and 2 deletions
|
@ -493,12 +493,20 @@ typedef uint32_t char_type;
|
|||
/**
|
||||
* Convert from an object to an integer.
|
||||
*/
|
||||
#ifdef __clang__
|
||||
#define obj_obj2int(n) (((long)((ulong)(n) & ~1))/(long)(1uL<<1))
|
||||
#else
|
||||
#define obj_obj2int(x) ((long)(x)>>1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Convert from an integer to an object.
|
||||
*/
|
||||
#ifdef __clang__
|
||||
#define obj_int2obj(n) ((void *) ((((long)(n))*(long)(1uL<<1)) | 1))
|
||||
#else
|
||||
#define obj_int2obj(c) ((void *)((((long)c)<<1) | 1))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Determine if the object is a char.
|
||||
|
|
Loading…
Add table
Reference in a new issue