Answer the question
In order to leave comments, you need to log in
What is the bitwise operator used in Golang for the Not (~PHP) operation?
The bitwise NOT operator in PHP
~ $a / Not / Bits that are set in $a are not set, and vice versa.
Answer the question
In order to leave comments, you need to log in
It seems that there is no suitable operator, but there is xor - ^. It accepts two numbers (a and b, for simplicity). Where bit b is set to 0, bit a remains, if bit is set to one, the bit is reversed. It turns out that bit negation is an xor of numbers with a mask of ones.
I don’t know exactly, but it seems that the mask of units is m
To do a bitwise NOT operation on the variable b, you need to write
https://play.golang.org/p/Y9SrDSgNmf
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question