From 3e22eb797f02cdb54a5eccc8c6ebce33e1e1d7d5 Mon Sep 17 00:00:00 2001 From: Drahflow Date: Sat, 11 Apr 2015 00:59:04 +0200 Subject: Sane handling of integer division --- elymas/lib/math.ey | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'elymas/lib/math.ey') diff --git a/elymas/lib/math.ey b/elymas/lib/math.ey index db04c7b..cc9b288 100644 --- a/elymas/lib/math.ey +++ b/elymas/lib/math.ey @@ -24,4 +24,26 @@ } /base deff > /math defv +# FIXME: INTEGRATE +# # 0 -> float +# # 0 <- the int portion of the float, rounded towards zero +# [[ +# /rbx :popqReg +# +# # allocate result int +# ::internalAllocateInteger /rax :movqImmReg +# /rax :callqReg +# +# # actual conversion +# /rcx :popqReg +# 8 /rcx :fld64MemDisp8 +# 8 /rax :fistp64MemDisp8 +# +# # push int on program stack +# /rax :pushqReg +# +# /rbx :pushqReg +# :retn +# ]] /eytrunc defv + # vim: syn=elymas -- cgit v1.2.3