smt - How to calculate logarithm base 2 to Bitvectors in Z3? -


is there function in z3 calculate directly logarithm bitvectors?

otherwise how can implement logarithm efficiently?

i think best bet code if-then-else chain look-up table. assuming base-2, you'd have (assuming lg 0 = 0):

(ite (< x 2) 0      (ite (< x 4) 1           (ite (< x 8) 2            .... etc ... 

since logarithm grows slowly, you'd need 32 branches 32-bit vectors, etc. other bases similar. can generate code automatically.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -