Skip to content

Instantly share code, notes, and snippets.

@SMT50001
SMT50001 / vfixp.nim
Last active March 16, 2023 19:12
Initial draft of fixed-point math library
import math
export math
{.push inline.}
when defined(release) and not defined(vfixpExplicitChecks):
{.push noinit, checks: off.}
template genFixpType*(gname, btyp: untyped, tsize, tfraction: int, upscaleto: typedesc) =
when tsize notin [16, 32]:
{.error: "Unsupported variable size".}