tensorflow/compiler/mlir/hlo/lib/utils/hlo_utils.cc
// Returns a scalar value for the given integer type.
//
// The argument 'scalar' describes which scalar value to return. `integer_value`
// is used to specify the integer value for kInteger. For any other scalar,
// integer_value is ignored.
Returns a scalar value for the given integer type.
The argument 'scalar' describes which scalar value to return. `integer_value`
is used to specify the integer value for kInteger. For any other scalar,
integer_value is ignored.
Returns a scalar value for the given integer type . The argument ' scalar ' describes which scalar value to return . ` integer_value ` is used to specify the integer value for kInteger . For any other scalar integer_value is ignored .
static APInt GetScalarLimitOfIntegerType(IntegerType integer_ty,
                                         ScalarLimit limit) {
  unsigned width = integer_ty.getWidth();
  bool is_bool = (width == 1);
  switch (limit) {
    case kLowest:
    case kInfinityLowest:
      if (integer_ty.isUnsigned() || is_bool) {
        return APInt::getMinValue(width);
      } else {
        return APInt::getSignedMinValue(width);
      }
    case kMax:
    case kInfinityMax:
      if (integer_ty.isUnsigned() || is_bool) {
        return APInt::getMaxValue(width);
      } else {
        return APInt::getSignedMaxValue(width);
      }
  }
  llvm_unreachable("invalid limit");
}
static APInt GetScalarLimitOfIntegerType ( IntegerType integer_ty , ScalarLimit limit ) { unsigned width = integer_ty . getWidth ( ) ; bool is_bool = ( width == 1 ) ; switch ( limit ) { case kLowest : case kInfinityLowest : if ( integer_ty . isUnsigned ( ) || is_bool ) { return APInt :: getMinValue ( width ) ; } else { return APInt :: getSignedMinValue ( width ) ; } case kMax : case kInfinityMax : if ( integer_ty . isUnsigned ( ) || is_bool ) { return APInt :: getMaxValue ( width ) ; } else { return APInt :: getSignedMaxValue ( width ) ; } } llvm_unreachable ( " " ) ; }
Returns a scalar value for the given integer type.
Returns a scalar value for the given integer type .