aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetteri.Aimonen <Petteri.Aimonen@gmail.com>2012-08-05 16:11:40 +0000
committerPetteri.Aimonen <Petteri.Aimonen@gmail.com>2012-08-05 16:11:40 +0000
commit40ef134f4d9f880a4f8848b1ac36ba993d9afa8c (patch)
treeb74242c852bbdacf56e0521986a1fd0ec30d165e
parent85204f4a28009408c97bd49df8a205be4e80638e (diff)
downloadlibfixmath-40ef134f4d9f880a4f8848b1ac36ba993d9afa8c.tar.gz
Add fix16_sq() inline function as a shorthand to square values
-rw-r--r--libfixmath/fix16.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/libfixmath/fix16.h b/libfixmath/fix16.h
index 0767627..1508aaf 100644
--- a/libfixmath/fix16.h
+++ b/libfixmath/fix16.h
@@ -187,7 +187,10 @@ static inline fix16_t fix16_deg_to_rad(fix16_t degrees)
*/
extern fix16_t fix16_sqrt(fix16_t inValue) FIXMATH_FUNC_ATTRS;
-
+/*! Returns the square of the given fix16_t.
+*/
+static inline fix16_t fix16_sq(fix16_t x)
+ { return fix16_mul(x, x); }
/*! Returns the exponent (e^) of the given fix16_t.
*/