HandmadeHero/project/platform/intrinsics.hpp
2023-10-11 23:58:04 -04:00

54 lines
699 B
C++

#pragma once
#if INTELLISENSE_DIRECTIVES
#include <math.h>
#endif
// TODO(Ed) : Convert all of these to platform-efficient versions
//inline
//s32 abs( s32 value )
//{
// return ;
//}
inline
s32 floor( f32 value )
{
s32 result = scast(s32, floorf( value ));
return result;
}
inline
s32 round( f32 value )
{
s32 result = scast(s32, roundf( value ));
return result;
}
inline
s32 truncate( f32 value )
{
s32 result = scast(s32, value);
return result;
}
inline
f32 sine( f32 angle )
{
f32 result = sinf( angle );
return result;
}
f32 cosine( f32 angle )
{
f32 result = cosf( angle );
return result;
}
f32 arc_tangent( f32 Y, f32 X )
{
f32 result = atan2f( Y, X );
return result;
}