Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
コード ベースに ^0 が表示されます。
例:
type stat struct { ... min int64 ... } newStat := stat{min: ^0}
^0 とはどういう意味ですか?
ドキュメントによると:
^x ビットごとの補数は m ^ x で、m = "すべてのビットが 1 に設定" されます。 符号なし x および符号付き x の場合は m = -1
^x ビットごとの補数は m ^ x で、m = "すべてのビットが 1 に設定" されます。
符号なし x および符号付き x の場合は m = -1
他の主流言語^0と同じという意味です。~0
^0
~0
2の補数(ほとんどのプログラミング言語が採用) では、0 の補数の値は -1 (符号付きデータ型) です。したがって、これは次のような書き方です。
newStat := stat{min: -1}