yiGmMk / comment_blog

the comments of www_programnotes_cn
0 stars 0 forks source link

golang technique | ProgramNotes #82

Open yiGmMk opened 2 years ago

yiGmMk commented 2 years ago

https://programnotes.cn/go-technique/index.html

go-repo code snippet 判断机器位数 1const intSize = 32 << (^uint(0) >> 63) 在64平台系统:  1. uint(0)在平台底层是0x0000000000000000  2. ^uint(0)在平台底层是0xFFFFFFFFFFFFFFFF  3. ^uint(0) >> 63 在底层平台是0x00