HandmadeHero/project/platform/intrinsics.hpp

54 lines
699 B
C++
Raw Normal View History

2023-10-06 23:33:39 -07:00
#pragma once
#if INTELLISENSE_DIRECTIVES
#include <math.h>
#endif
// TODO(Ed) : Convert all of these to platform-efficient versions
2023-10-10 21:56:16 -07:00
//inline
//s32 abs( s32 value )
//{
// return ;
//}
2023-10-06 23:33:39 -07:00
inline
2023-10-10 21:56:16 -07:00
s32 floor( f32 value )
2023-10-06 23:33:39 -07:00
{
s32 result = scast(s32, floorf( value ));
return result;
}
inline
2023-10-10 21:56:16 -07:00
s32 round( f32 value )
2023-10-06 23:33:39 -07:00
{
2023-10-11 14:52:13 -07:00
s32 result = scast(s32, roundf( value ));
2023-10-06 23:33:39 -07:00
return result;
}
inline
2023-10-10 21:56:16 -07:00
s32 truncate( f32 value )
2023-10-06 23:33:39 -07:00
{
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;
}