Could someone please explain to me the usage of <<
and >>
in Go? I guess it is similar to some other languages.
相关问题
- Golang mongodb aggregation
- How to flatten out a nested json structure in go
- how to install private repo using glide golang
- How to convert a string to a byte array which is c
- IntelliJ 2017.1.2 GOLANG debug does not work on br
相关文章
- Can I run a single test in a suite?
- How to check if a request was cancelled
- Is it possible to implement an interface with unex
- Construction an logical expression which will coun
- How to access value of first index of array in Go
- Embedded Interface
- How to represent an array with mixed types
- go tutorial select statement
<<
is left shift.>>
is sign-extending right shift when the left operand is a signed integer, and is zero-extending right shift when the left operand is an unsigned integer.To better understand
>>
think ofSo when applied to an unsigned integer, the bits at the left are filled with zero, whereas when applied to a signed integer, the bits at the left are filled with the leftmost bit (which is 1 when the signed integer is negative as per 2's complement).