This repository has been archived on 2023-09-28. You can view files and clone it, but cannot push or open issues or pull requests.
homepage/content/projects/noxos/docs/codebase/utils/math.h.md

1.1 KiB

title summary
math.h mathematical functions, definitions, etc.

MAX(a, b) - macro

Returns the bigger one of the given values.

MIN(a, b) - macro

Returns the smaller one of the given values.

CEIL_TO(a, b) - macro

Aligns a upwards to b. Example: CEIL_TO(13, 8) would return 16, because 16 is the next higher multiple of 8 after 13.

FLOOR_TO(a, b) - macro

Aligns a downwards to b. Example: FLOOR_TO(13, 8) would return 8, because 8 is the next smaller multiple of 8 before 13.

position_T - struct

This describes a position in 2D space.

Name Description
x X coordinate of the position
y Y coordinate of the position

pow(base, exponent) - function (uint64_t)

Returns the power of base ^ exponent.

abs(number) - function (uint64_t)

Returns the absolute value of number.

octal_string_to_int(string, size) - function (uint64_t)

Converts a base-8 string with length size into an integer and returns it.