about summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
* fixAnselm R Garbe2008-05-311-1/+1
* lt->arrange in mfactAnselm R Garbe2008-05-311-1/+1
* isfixed implies isfloatingAnselm R Garbe2008-05-301-1/+1
* applied nibbles fixes, slightly modifiedAnselm R Garbe2008-05-291-2/+2
* applied yiyus tip patch from tueAnselm R Garbe2008-05-291-24/+24
* core dump fix in cleanupAnselm R Garbe2008-05-281-1/+1
* updated the initial comment to reflect the use of bit arraysAnselm R Garbe2008-05-261-2/+2
* slight changesAnselm R Garbe2008-05-261-6/+3
* removed bx and bw, unnecessaryAnselm R Garbe2008-05-261-10/+8
* renamed domax into ismaxAnselm R Garbe2008-05-261-8/+8
* simplified tile()Anselm R Garbe2008-05-261-37/+15
* removed Layout->updategeom, unnecessaryAnselm R Garbe2008-05-262-28/+16
* removed TEXTWAnselm R Garbe2008-05-261-10/+5
* applied yiyus domax patch with slight modificationsAnselm R Garbe2008-05-263-76/+55
* replaced isvisible with a macroAnselm R Garbe2008-05-221-17/+12
* removed emalloczAnselm R Garbe2008-05-221-11/+2
* s/int/uint/ in config.hAnselm R Garbe2008-05-221-38/+38
* removed debug output, sanitized tag limit checkAnselm R Garbe2008-05-221-11/+2
* setmfact argument was wrongAnselm R Garbe2008-05-221-2/+2
* Key.mod is uint, Client.[old]bw is intAnselm R Garbe2008-05-221-2/+2
* s/unsigned long/ulong/Anselm R Garbe2008-05-221-10/+11
* s/nextunfloating/nexttiled/, changed zoom() behaviorAnselm R Garbe2008-05-221-12/+12
* s/unsigned int/uint/Anselm R Garbe2008-05-221-33/+34
* s/void */const void */Anselm R Garbe2008-05-221-32/+32
* applied Gottox bitmask + void *arg patchAnselm R Garbe2008-05-223-168/+138
* some minor fixesanselm@anselm12008-05-191-2/+2
* simplificationanselm@anselm12008-05-192-5/+3
* reverted dist target in Makefileanselm@anselm12008-05-191-1/+1
* merged tile.c again into dwm.canselm@anselm12008-05-193-106/+101
* take bar into accountAnselm R Garbe2008-05-191-1/+1
* be more polite to clients which like to appear outside the window area, but s...Anselm R Garbe2008-05-191-6/+6
* fixed commentAnselm R Garbe2008-05-191-1/+1
* fixAnselm R Garbe2008-05-191-1/+1
* make it easier for the user, if Xinerama support is given, always use the scr...Anselm R Garbe2008-05-193-16/+37
* improving space usage if master is left of stack (default)Anselm R Garbe2008-05-191-3/+5
* only snap within window areaAnselm R Garbe2008-05-191-12/+19
* s/DEFGEOM/CUSTOMGEOM/Anselm R Garbe2008-05-191-2/+2
* updateAnselm R Garbe2008-05-191-4/+0
* updatetilegeom should be fine for setmfactAnselm R Garbe2008-05-191-1/+1
* recent changes, introduced togglebar, changed some defines into variable decl...Anselm R Garbe2008-05-193-33/+53
* new stuffAnselm R Garbe2008-05-171-2/+2
* removed the <M> togglelayout callAnselm R Garbe2008-05-172-5/+2
* s/tilegeom/updatetilegeom/Anselm R Garbe2008-05-171-16/+16
* removed monocle for nowAnselm R Garbe2008-05-173-14/+0
* removed the exact focus mechanism of next/prev windowAnselm R Garbe2008-05-174-26/+16
* moved all tile()-related stuff into tile.c which is included from config.def....Anselm R Garbe2008-05-173-108/+119
* removed tileh, renamed tilev into tile again, removed counttiles, tilemasterAnselm R Garbe2008-05-172-57/+15
* removed Layout->isfloatingAnselm R Garbe2008-05-172-31/+21
* removed reapply() -- unnecessaryAnselm R Garbe2008-05-172-13/+0
* renamed setlayout into togglelayoutAnselm R Garbe2008-05-172-98/+97
>a, b: int64): int64 {.compilerProc, inline.} = result = a +% b if (result xor a) >= int64(0) or (result xor b) >= int64(0): return result raiseOverflow() proc subInt64(a, b: int64): int64 {.compilerProc, inline.} = result = a -% b if (result xor a) >= int64(0) or (result xor not b) >= int64(0): return result raiseOverflow() proc negInt64(a: int64): int64 {.compilerProc, inline.} = if a != low(int64): return -a raiseOverflow() proc absInt64(a: int64): int64 {.compilerProc, inline.} = if a != low(int64): if a >= 0: return a else: return -a raiseOverflow() proc divInt64(a, b: int64): int64 {.compilerProc, inline.} = if b == int64(0): raiseDivByZero() if a == low(int64) and b == int64(-1): raiseOverflow() return a div b proc modInt64(a, b: int64): int64 {.compilerProc, inline.} = if b == int64(0): raiseDivByZero() return a mod b # # This code has been inspired by Python's source code. # The native int product x*y is either exactly right or *way* off, being # just the last n bits of the true product, where n is the number of bits # in an int (the delivered product is the true product plus i*2**n for # some integer i). # # The native float64 product x*y is subject to three # rounding errors: on a sizeof(int)==8 box, each cast to double can lose # info, and even on a sizeof(int)==4 box, the multiplication can lose info. # But, unlike the native int product, it's not in *range* trouble: even # if sizeof(int)==32 (256-bit ints), the product easily fits in the # dynamic range of a float64. So the leading 50 (or so) bits of the float64 # product are correct. # # We check these two ways against each other, and declare victory if they're # approximately the same. Else, because the native int product is the only # one that can lose catastrophic amounts of information, it's the native int # product that must have overflowed. # proc mulInt64(a, b: int64): int64 {.compilerproc.} = var resAsFloat, floatProd: float64 result = a *% b floatProd = toBiggestFloat(a) # conversion floatProd = floatProd * toBiggestFloat(b) resAsFloat = toBiggestFloat(result) # Fast path for normal case: small multiplicands, and no info # is lost in either method. if resAsFloat == floatProd: return result # Somebody somewhere lost info. Close enough, or way off? Note # that a != 0 and b != 0 (else resAsFloat == floatProd == 0). # The difference either is or isn't significant compared to the # true value (of which floatProd is a good approximation). # abs(diff)/abs(prod) <= 1/32 iff # 32 * abs(diff) <= abs(prod) -- 5 good bits is "close enough" if 32.0 * abs(resAsFloat - floatProd) <= abs(floatProd): return result raiseOverflow() proc absInt(a: int): int {.compilerProc, inline.} = if a != low(int): if a >= 0: return a else: return -a raiseOverflow() const asmVersion = defined(I386) and (defined(vcc) or defined(wcc) or defined(dmc) or defined(gcc) or defined(llvm_gcc)) # my Version of Borland C++Builder does not have # tasm32, which is needed for assembler blocks # this is why Borland is not included in the 'when' when asmVersion and not defined(gcc) and not defined(llvm_gcc): # assembler optimized versions for compilers that # have an intel syntax assembler: proc addInt(a, b: int): int {.compilerProc, noStackFrame.} = # a in eax, and b in edx asm """ mov eax, `a` add eax, `b` jno theEnd call `raiseOverflow` theEnd: """ proc subInt(a, b: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` sub eax, `b` jno theEnd call `raiseOverflow` theEnd: """ proc negInt(a: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` neg eax jno theEnd call `raiseOverflow` theEnd: """ proc divInt(a, b: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` mov ecx, `b` xor edx, edx idiv ecx jno theEnd call `raiseOverflow` theEnd: """ proc modInt(a, b: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` mov ecx, `b` xor edx, edx idiv ecx jno theEnd call `raiseOverflow` theEnd: mov eax, edx """ proc mulInt(a, b: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` mov ecx, `b` xor edx, edx imul ecx jno theEnd call `raiseOverflow` theEnd: """ elif false: # asmVersion and (defined(gcc) or defined(llvm_gcc)): proc addInt(a, b: int): int {.compilerProc, inline.} = # don't use a pure proc here! asm """ "addl %%ecx, %%eax\n" "jno 1\n" "call _raiseOverflow\n" "1: \n" :"=a"(`result`) :"a"(`a`), "c"(`b`) """ proc subInt(a, b: int): int {.compilerProc, inline.} = asm """ "subl %%ecx,%%eax\n" "jno 1\n" "call _raiseOverflow\n" "1: \n" :"=a"(`result`) :"a"(`a`), "c"(`b`) """ proc mulInt(a, b: int): int {.compilerProc, inline.} = asm """ "xorl %%edx, %%edx\n" "imull %%ecx\n" "jno 1\n" "call _raiseOverflow\n" "1: \n" :"=a"(`result`) :"a"(`a`), "c"(`b`) :"%edx" """ proc negInt(a: int): int {.compilerProc, inline.} = asm """ "negl %%eax\n" "jno 1\n" "call _raiseOverflow\n" "1: \n" :"=a"(`result`) :"a"(`a`) """ proc divInt(a, b: int): int {.compilerProc, inline.} = asm """ "xorl %%edx, %%edx\n" "idivl %%ecx\n" "jno 1\n" "call _raiseOverflow\n" "1: \n" :"=a"(`result`) :"a"(`a`), "c"(`b`) :"%edx" """ proc modInt(a, b: int): int {.compilerProc, inline.} = asm """ "xorl %%edx, %%edx\n" "idivl %%ecx\n" "jno 1\n" "call _raiseOverflow\n" "1: \n" "movl %%edx, %%eax" :"=a"(`result`) :"a"(`a`), "c"(`b`) :"%edx" """ # Platform independant versions of the above (slower!) when not defined(addInt): proc addInt(a, b: int): int {.compilerProc, inline.} = result = a +% b if (result xor a) >= 0 or (result xor b) >= 0: return result raiseOverflow() when not defined(subInt): proc subInt(a, b: int): int {.compilerProc, inline.} = result = a -% b if (result xor a) >= 0 or (result xor not b) >= 0: return result raiseOverflow() when not defined(negInt): proc negInt(a: int): int {.compilerProc, inline.} = if a != low(int): return -a raiseOverflow() when not defined(divInt): proc divInt(a, b: int): int {.compilerProc, inline.} = if b == 0: raiseDivByZero() if a == low(int) and b == -1: raiseOverflow() return a div b when not defined(modInt): proc modInt(a, b: int): int {.compilerProc, inline.} = if b == 0: raiseDivByZero() return a mod b when not defined(mulInt): # # This code has been inspired by Python's source code. # The native int product x*y is either exactly right or *way* off, being # just the last n bits of the true product, where n is the number of bits # in an int (the delivered product is the true product plus i*2**n for # some integer i). # # The native float64 product x*y is subject to three # rounding errors: on a sizeof(int)==8 box, each cast to double can lose # info, and even on a sizeof(int)==4 box, the multiplication can lose info. # But, unlike the native int product, it's not in *range* trouble: even # if sizeof(int)==32 (256-bit ints), the product easily fits in the # dynamic range of a float64. So the leading 50 (or so) bits of the float64 # product are correct. # # We check these two ways against each other, and declare victory if # they're approximately the same. Else, because the native int product is # the only one that can lose catastrophic amounts of information, it's the # native int product that must have overflowed. # proc mulInt(a, b: int): int {.compilerProc.} = var resAsFloat, floatProd: float result = a *% b floatProd = toFloat(a) * toFloat(b) resAsFloat = toFloat(result) # Fast path for normal case: small multiplicands, and no info # is lost in either method. if resAsFloat == floatProd: return result # Somebody somewhere lost info. Close enough, or way off? Note # that a != 0 and b != 0 (else resAsFloat == floatProd == 0). # The difference either is or isn't significant compared to the # true value (of which floatProd is a good approximation). # abs(diff)/abs(prod) <= 1/32 iff # 32 * abs(diff) <= abs(prod) -- 5 good bits is "close enough" if 32.0 * abs(resAsFloat - floatProd) <= abs(floatProd): return result raiseOverflow() # We avoid setting the FPU control word here for compatibility with libraries # written in other languages. proc raiseFloatInvalidOp {.noinline, noreturn.} = raise newException(EFloatInvalidOp, "FPU operation caused a NaN result") proc nanCheck(x: float64) {.compilerProc, inline.} = if x != x: raiseFloatInvalidOp() proc raiseFloatOverflow(x: float64) {.noinline, noreturn.} = if x > 0.0: raise newException(EFloatOverflow, "FPU operation caused an overflow") else: raise newException(EFloatUnderflow, "FPU operations caused an underflow") proc infCheck(x: float64) {.compilerProc, inline.} = if x != 0.0 and x*0.5 == x: raiseFloatOverflow(x)