Please feel free to provide feedback or file bugs here.

[Bug] Bitwise AND operation on long value is ignored when Most-Significant 32 bits is masked with zero

[Bug] Bitwise AND operation on long value is ignored when Most-Significant 32 bits is masked with zero

Sample Code to replicate issue:

[BitConverter]::GetBytes([BitConverter]::ToInt64(@(1,1,168,192,255,255,255,255), 0) -band 0x00000000ffffffff)

Should return: @(1,1,168,192,0,0,0,0)
Actually returns : @(1,1,168,192,255,255,255,255)

4 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Keith Geronimo Jackson shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • PetSerAl commented  ·   ·  Flag as inappropriate

        0x00000000ffffffff is [int] literal not [long]. Thus, when this [int] is sign-expanded to [long] it result in 0xffffffffffffffff [long] value.

      Feedback and Knowledge Base