Hello everyone, I’ve been using UR script for a while and noticed there were no bit-wise operators such as OR, AND, XOR, and shift left and right. Would there be a possibility to add these? I’ve been using custom functions that I’ve written to replace these operators:
def bit_and(par1, par2): par1bits = integer_to_binary_list(par1) par2bits = integer_to_binary_list(par2) outBits = integer_to_binary_list(0) i = 0 while i < 32: outBits[i] = par1bits[i] and par2bits[i] i = i + 1 end return binary_list_to_integer(outBits) end
and so on for OR and XOR.
Would there also be a way to allow UR script to allow hexadecimal numbers? such as ‘0x000F’ to represent a decimal ‘16’.
These would be all QOL changes, as the absence of these can all can be worked around but I think it could speed up some scripting applications.
@richard.abbott may want to log that also under feature requests, good idea!
Also, the to_num() method can take hexadecimal as a valid data type and return the number so you would think that it would be possible to make the parser understand hexadecimal.