I was thinking of a way to implement a NOT operation/instruction for IJVM so that I could write a multiplication JAS method, but I'm having trouble trying to implement a negation method.
Can anyone help out with a way to go about doing this?
I was thinking of a way to implement a NOT operation/instruction for IJVM so that I could write a multiplication JAS method, but I'm having trouble trying to implement a negation method.
Can anyone help out with a way to go about doing this?
Copyright © 2021 Jogjafile Inc.
Basically there are various ways to calculate the one's complement of a value, i.e.
NOT:I don't know about IJVM but as described here it supports only 4 arithmetic operations
IADD,ISUB,IANDandIOR. You can useISUBto achieve thisNow for more fun we can do
not_x = x XOR ~0 = (x OR ~0) - (x AND ~0)since
a XOR b = (a OR b) - (a AND b). An alternative solution is to use a lookup table