gitee.com/zhongguo168a/gocodes@v0.0.0-20230609140523-e1828349603f/datax/binaryx/state.go (about)

     1  package binaryx
     2  
     3  func GetState(state uint, key uint) bool {
     4  	return state&key != 0
     5  }
     6  
     7  func SetState(state uint, key uint, value bool) uint {
     8  	if value {
     9  		state |= key
    10  	} else {
    11  		state &= ^key
    12  	}
    13  	return state
    14  }