hey there i am trying to implement DataOutputStream in php (DataOutputStream from java language) in java code they shift right variables like this >>>
in php i can only shift like this >>
how can i do this in php ?
thank you
hey there i am trying to implement DataOutputStream in php (DataOutputStream from java language) in java code they shift right variables like this >>>
in php i can only shift like this >>
how can i do this in php ?
thank you
You can implement the behavior of the unsigned right shift operator >>> with the signed shift operators like this:
The value of
n>>>sisnright-shiftedsbit positions with zero-extension. Ifnis positive, then the result is the same as that ofn>>s; ifnis negative, the result is equal to that of the expression(n>>s)+(2<<~s)if the type of the left-hand operand is int, and to the result of the expression(n>>s)+(2L<<~s)if the type of the left-hand operand is long. The added term(2<<~s)or(2L<<~s)cancels out the propagated sign bit.