[Wisp-cvs] wisp/users/dig tran-builtins,1.41,1.42 tran.py,1.135,1.136
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-05-22 20:06:47
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv30277 Modified Files: tran-builtins tran.py Log Message: implemented |roundup| Index: tran-builtins =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran-builtins,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- tran-builtins 22 May 2003 17:21:01 -0000 1.41 +++ tran-builtins 22 May 2003 20:06:44 -0000 1.42 @@ -158,6 +158,11 @@ if not name[0] in '&#!': name = '&' + name interpreter.regstack.append(Symbol_Literal(name)) +roundup int int + boundary = long(interpreter.regstack.pop()) + value = long(interpreter.regstack.pop()) + interpreter.regstack.append(Integer_Literal(roundup(value, boundary))) + section|name interpreter.switch_to_section(name) Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.135 retrieving revision 1.136 diff -u -d -r1.135 -r1.136 --- tran.py 22 May 2003 19:54:09 -0000 1.135 +++ tran.py 22 May 2003 20:06:44 -0000 1.136 @@ -14,6 +14,9 @@ from linkie import Linkie from shlex import shlex +def roundup (value, boundary): + return (value + boundary - 1) & ~(boundary - 1) + def abstract (this, *arg, **narg): raise 'abstract method was called', (this, arg, narg) |