You are viewing a single comment's thread. Return to all comments →
This is about as concise as I can make it in Scala:
def flippingBits(n: Long): Long = { BigInt((n ^ 0xFFFFFFFF).toBinaryString.takeRight(32), 2).toLong }
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping bits
You are viewing a single comment's thread. Return to all comments →
This is about as concise as I can make it in Scala: