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 --- compiler/standardClient.ey | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'compiler/standardClient.ey') diff --git a/compiler/standardClient.ey b/compiler/standardClient.ey index 6df429c..b31011c 100644 --- a/compiler/standardClient.ey +++ b/compiler/standardClient.ey @@ -80,7 +80,7 @@ < 0 ==size [ maxSize { 0 }" rep ] =*get - maxSize 1 sub 8 div 1 add 8 mul str .alloc _ zero ==pcUsed + maxSize 1 sub 8 udiv 1 add 8 mul str .alloc _ zero ==pcUsed { # ==thread _ threadGetPC pcUsed bitTest { -- }" { @@ -898,8 +898,8 @@ sys .asm .intToFloat } each ] =*:FLOAT - { - [ -01 16 { _ 16 mod base16digits * -01 16 div } rep -- ] reverse str .fromArray + { _ 0 lt { neg "-" } { "" } ? * -01 + [ -01 16 { _ 16 umod base16digits * -01 16 udiv } rep -- ] reverse str .fromArray cat } /base16encode64 deffd { ==indent _ ==o @@ -985,13 +985,13 @@ 1 0 { strNumber * 48 sub [ 0 1 2 3 4 5 6 7 8 9 0 0 0 0 0 0 0 10 11 12 13 14 15 ] * } -20*10* 16 mul add } "%" defq - { 8 { _ 256 mod -01 256 div } rep -- } /uint64 deffd - { _ 0 lt { 4294967296 add } rep 4294967295 band 4 { _ 256 mod -01 256 div } rep -- } /uint32 deffd - { _ 0 lt { 65536 add } rep 65535 band 2 { _ 256 mod -01 256 div } rep -- } /uint16 deffd + { 8 { _ 256 umod -01 256 udiv } rep -- } /uint64 deffd + { _ 0 lt { 4294967296 add } rep 4294967295 band 4 { _ 256 umod -01 256 udiv } rep -- } /uint32 deffd + { _ 0 lt { 65536 add } rep 65535 band 2 { _ 256 umod -01 256 udiv } rep -- } /uint16 deffd { _ 0 lt { 256 add } rep 255 band } /uint8 deffd { ==align ==value - align value align mod sub align mod + align value align umod sub align umod } /alignUpto deff sys .file ==out -- cgit v1.2.3