std.meta.IntType -> std.meta.Int

This commit is contained in:
Tadeo Kondrak
2020-04-28 19:10:09 -06:00
parent eb183ad9fe
commit 350b2adacd
40 changed files with 107 additions and 107 deletions

View File

@@ -9,8 +9,8 @@ const maxInt = std.math.maxInt;
const minInt = std.math.minInt;
pub const Limb = usize;
pub const DoubleLimb = std.meta.IntType(false, 2 * Limb.bit_count);
pub const SignedDoubleLimb = std.meta.IntType(true, DoubleLimb.bit_count);
pub const DoubleLimb = std.meta.Int(false, 2 * Limb.bit_count);
pub const SignedDoubleLimb = std.meta.Int(true, DoubleLimb.bit_count);
pub const Log2Limb = math.Log2Int(Limb);
comptime {
@@ -272,7 +272,7 @@ pub const Int = struct {
switch (@typeInfo(T)) {
.Int => |info| {
const UT = if (T.is_signed) std.meta.IntType(false, T.bit_count - 1) else T;
const UT = if (T.is_signed) std.meta.Int(false, T.bit_count - 1) else T;
try self.ensureCapacity(@sizeOf(UT) / @sizeOf(Limb));
self.metadata = 0;
@@ -335,7 +335,7 @@ pub const Int = struct {
pub fn to(self: Int, comptime T: type) ConvertError!T {
switch (@typeInfo(T)) {
.Int => {
const UT = std.meta.IntType(false, T.bit_count);
const UT = std.meta.Int(false, T.bit_count);
if (self.bitCountTwosComp() > T.bit_count) {
return error.TargetTooSmall;

View File

@@ -127,8 +127,8 @@ pub const Rational = struct {
// Translated from golang.go/src/math/big/rat.go.
debug.assert(@typeInfo(T) == .Float);
const UnsignedIntType = std.meta.IntType(false, T.bit_count);
const f_bits = @bitCast(UnsignedIntType, f);
const UnsignedInt = std.meta.Int(false, T.bit_count);
const f_bits = @bitCast(UnsignedInt, f);
const exponent_bits = math.floatExponentBits(T);
const exponent_bias = (1 << (exponent_bits - 1)) - 1;
@@ -186,7 +186,7 @@ pub const Rational = struct {
debug.assert(@typeInfo(T) == .Float);
const fsize = T.bit_count;
const BitReprType = std.meta.IntType(false, T.bit_count);
const BitReprType = std.meta.Int(false, T.bit_count);
const msize = math.floatMantissaBits(T);
const msize1 = msize + 1;

View File

@@ -44,7 +44,7 @@ const pi4c = 2.69515142907905952645E-15;
const m4pi = 1.273239544735162542821171882678754627704620361328125;
fn cos_(comptime T: type, x_: T) T {
const I = std.meta.IntType(true, T.bit_count);
const I = std.meta.Int(true, T.bit_count);
var x = x_;
if (math.isNan(x) or math.isInf(x)) {

View File

@@ -145,7 +145,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
var xe = r2.exponent;
var x1 = r2.significand;
var i = @floatToInt(std.meta.IntType(true, T.bit_count), yi);
var i = @floatToInt(std.meta.Int(true, T.bit_count), yi);
while (i != 0) : (i >>= 1) {
const overflow_shift = math.floatExponentBits(T) + 1;
if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) {

View File

@@ -45,7 +45,7 @@ const pi4c = 2.69515142907905952645E-15;
const m4pi = 1.273239544735162542821171882678754627704620361328125;
fn sin_(comptime T: type, x_: T) T {
const I = std.meta.IntType(true, T.bit_count);
const I = std.meta.Int(true, T.bit_count);
var x = x_;
if (x == 0 or math.isNan(x)) {

View File

@@ -31,7 +31,7 @@ pub fn sqrt(x: var) Sqrt(@TypeOf(x)) {
}
}
fn sqrt_int(comptime T: type, value: T) std.meta.IntType(false, T.bit_count / 2) {
fn sqrt_int(comptime T: type, value: T) std.meta.Int(false, T.bit_count / 2) {
var op = value;
var res: T = 0;
var one: T = 1 << (T.bit_count - 2);
@@ -50,7 +50,7 @@ fn sqrt_int(comptime T: type, value: T) std.meta.IntType(false, T.bit_count / 2)
one >>= 2;
}
const ResultType = std.meta.IntType(false, T.bit_count / 2);
const ResultType = std.meta.Int(false, T.bit_count / 2);
return @intCast(ResultType, res);
}
@@ -66,7 +66,7 @@ test "math.sqrt_int" {
/// Returns the return type `sqrt` will return given an operand of type `T`.
pub fn Sqrt(comptime T: type) type {
return switch (@typeInfo(T)) {
.Int => |int| std.meta.IntType(false, int.bits / 2),
.Int => |int| std.meta.Int(false, int.bits / 2),
else => T,
};
}

View File

@@ -38,7 +38,7 @@ const pi4c = 2.69515142907905952645E-15;
const m4pi = 1.273239544735162542821171882678754627704620361328125;
fn tan_(comptime T: type, x_: T) T {
const I = std.meta.IntType(true, T.bit_count);
const I = std.meta.Int(true, T.bit_count);
var x = x_;
if (x == 0 or math.isNan(x)) {