3.12.2011

Mind is weak today. Made a macro that alters a variable x my nested a single function repeatedly, generating stuff like DEC(DEC(...DEC(x)...)) and so on. So using INC as the command, it decreases a value n times, making it an effective subtraction with much stuff to write. Cool thing is, you can also nest it as often as you want cause the x get evaluated before they enters the loop itself. I also completely replace all INCs with DECs and formed all further INCs and ADDs with NOT(SUB/DEC(NOT(x))). Since I use decrementing more often in loops and comparisons, I can benefit from having less complex DEC operations. I also found out that I'll need to "catch" the overlow that occurs when subtracting a bigger (b) from a smaller (a) value to check whether b is greater than a. Luckily, astack overflow user once asked for how to archieve using gates in electronic circuits. So I got the proof that I can do this comftable with just decrementing and checks for zero.

No comments: