Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions impl/fxp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ namespace SaturnMath::Types
return (a < b) ? a : b;
}

/**
* @brief Returns the absolute value of a fixed-point value.
* @param v Input value
* @return |v|
*/
static constexpr Fxp Abs(const Fxp& v)
{
return (v < 0) ? -v : v;
}

/**
* @brief Creates fixed-point from raw 16.16 value.
* @param rawValue Raw fixed-point bits
Expand Down