def ZigZagDecode(value):
 if (not (value & 1)):
  return (value >> 1)
 return ((value >> 1) ^ (~ 0))

def ZigZagDecode ( value ) : if ( not ( value & 1 ) ) : return ( value >> 1 ) return ( ( value >> 1 ) ^ ( ~ 0 ) )
inverse of zigzagencode() .