Source file src/cmd/compile/internal/ssarewrite/rewrites390x/s390x_helpers.go

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package rewrites390x
     6  
     7  // is8Bit reports whether n can be represented as a signed 8 bit integer.
     8  func is8Bit(n int64) bool {
     9  	return n == int64(int8(n))
    10  }
    11  
    12  // isU12Bit reports whether n can be represented as an unsigned 12 bit integer.
    13  func isU12Bit(n int64) bool {
    14  	return 0 <= n && n < (1<<12)
    15  }
    16  
    17  // isU8Bit reports whether n can be represented as an unsigned 8 bit integer.
    18  func isU8Bit(n int64) bool {
    19  	return n == int64(uint8(n))
    20  }
    21  

View as plain text