mirror of
https://github.com/recp/cglm.git
synced 2025-12-24 20:34:58 +00:00
helper for get sign of integer
This commit is contained in:
@@ -10,6 +10,17 @@
|
||||
|
||||
#include "cglm-common.h"
|
||||
|
||||
/*!
|
||||
* @brief get sign of 32 bit integer as +1 or -1
|
||||
*
|
||||
* @param X integer value
|
||||
*/
|
||||
CGLM_INLINE
|
||||
int
|
||||
glm_sign(int val) {
|
||||
return ((val >> 31) - (-val >> 31));
|
||||
}
|
||||
|
||||
CGLM_INLINE
|
||||
float
|
||||
glm_rad(float deg) {
|
||||
|
||||
Reference in New Issue
Block a user