diff --git a/src/threads/fixed-point.h b/src/threads/fixed-point.h index c0a6100..697467d 100644 --- a/src/threads/fixed-point.h +++ b/src/threads/fixed-point.h @@ -17,14 +17,14 @@ typedef struct inline fp32_t int_to_fp (int32_t n) { - return { n * CONVERSION_CONST }; + return (fp32_t){ n * CONVERSION_CONST }; } /* Handles conversion of fixed point to integer. First version truncates, second one rounds */ inline int32_t fp_floor (fp32_t x) { - return { x.raw / CONVERSION_CONST }; + return x.raw / CONVERSION_CONST; } inline int32_t @@ -40,56 +40,56 @@ fp_round (fp32_t x) inline fp32_t fp_add (fp32_t x, fp32_t y) { - return { x.raw + y.raw }; + return (fp32_t){ x.raw + y.raw }; } /* Subtract two fixed points */ inline fp32_t fp_sub (fp32_t x, fp32_t y) { - return { x.raw - y.raw }; + return (fp32_t){ x.raw - y.raw }; } /* Add fixed point to integer */ inline fp32_t fp_add_int (fp32_t x, int32_t n) { - return { x.raw + n * CONVERSION_CONST }; + return (fp32_t){ x.raw + n * CONVERSION_CONST }; } /* Subtract integer from fixed point */ inline fp32_t fp_sub_int (fp32_t x, int32_t n) { - return { x.raw - n * CONVERSION_CONST }; + return (fp32_t){ x.raw - n * CONVERSION_CONST }; } /* Multiple two fixed points */ inline fp32_t fp_mul (fp32_t x, fp32_t y) { - return { ((int64_t)x.raw) * y.raw / CONVERSION_CONST }; + return (fp32_t){ ((int64_t)x.raw) * y.raw / CONVERSION_CONST }; } /* Divide two fixed points */ inline fp32_t fp_div (fp32_t x, fp32_t y) { - return { ((int64_t)x.raw) * CONVERSION_CONST / y.raw }; + return (fp32_t){ ((int64_t)x.raw) * CONVERSION_CONST / y.raw }; } /* Multiply fixed point and integer */ inline fp32_t fp_mul_int (fp32_t x, int32_t n) { - return { x.raw * n }; + return (fp32_t){ x.raw * n }; } /* Divide fixed point by integer */ inline fp32_t fp_div_int (fp32_t x, int32_t n) { - return { x.raw / n }; + return (fp32_t){ x.raw / n }; } #endif //FIXED_POINT_H