From 5deb916d7b4576e7bff13788a27ad9c64081f1c4 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Wed, 1 Sep 2010 21:05:36 +0100 Subject: [PATCH] Slight optimiser cleanup --- src/idiotism.oil | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/idiotism.oil b/src/idiotism.oil index c972259..fceb718 100644 --- a/src/idiotism.oil +++ b/src/idiotism.oil @@ -214,15 +214,12 @@ ; Shifts -; A helper in calculating 32-bit shifts; this is a shift on half the bits of -; a 32-bit number. -[lshift32half] -(#0$((_1~#715827882)<<#1))->((_1�)<<#1) ; Rightshift some of the bits [rshift] <#1-#31 (_1~#{xselx(x)<((_1&_2)>>#{r}0) > + ; General 16-bit leftshifts ; ; Large left-shifts can be written in an optimized way using knowledge of the @@ -252,6 +249,11 @@ <<#{setbitcount(x3&((2LU<<(r*2))-1))}0)|#{iselect(mingle(x4,x2),x3)}0) > +; A helper in calculating 32-bit shifts; this is a shift on half the bits of +; a 32-bit number. +[lshift32half] +(#0$((:1~#715827882)<<#1))->((:1�)<<#1) +(#0$((:1�)~#715827883))->((:1�)<<#1) ; 32-bit leftshift by 1; there are 8 ways to write this. [lshift32by1] @@ -264,10 +266,6 @@ (((#715827882&_1)<<#1)|((_1�)<<#1))->((_1�)<<#1) (((#715827882&_1)<<#1)|((#1431655765&_1)<<#1))->((_1�)<<#1) -; a weird part of a leftshift -[lshift32half] -(#0$((:1�)~#715827883))->((:1�)<<#1) - ; Move rshift, AND out of neg [rshiftoutofneg] (~16 (.1 >> #{1}2))->(((~16 .1) >> _2) | #32768) -- 2.43.0