go產平生臺相關的0xFFFF

一個網友問的,如何在64位機器上產生16個F,如何在32位機器產生8個F,固然要動態生成的,因此有了下面的代碼:ui

package main

import (
	"fmt"
	"strconv"
)

func main() {
	size := strconv.IntSize
	value := uint(1<<uint(size) - 1)
	fmt.Println(value)
}
相關文章
相關標籤/搜索