Skip to content

Commit

Permalink
Use underscores for number literals with five or more digits
Browse files Browse the repository at this point in the history
  • Loading branch information
JackStouffer committed Feb 23, 2017
1 parent 22331db commit 4ce5d44
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 159 deletions.
192 changes: 96 additions & 96 deletions etc/c/curl.d

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions etc/c/odbc/sql.d
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ enum
SQL_HANDLE_DESC = 4,

// * environment attribute *
SQL_ATTR_OUTPUT_NTS = 10001,
SQL_ATTR_OUTPUT_NTS = 10_001,

// * connection attributes *
SQL_ATTR_AUTO_IPD = 10001,
SQL_ATTR_METADATA_ID = 10014,
SQL_ATTR_AUTO_IPD = 10_001,
SQL_ATTR_METADATA_ID = 10_014,

// * statement attributes *
SQL_ATTR_APP_ROW_DESC = 10010,
SQL_ATTR_APP_PARAM_DESC = 10011,
SQL_ATTR_IMP_ROW_DESC = 10012,
SQL_ATTR_IMP_PARAM_DESC = 10013,
SQL_ATTR_APP_ROW_DESC = 10_010,
SQL_ATTR_APP_PARAM_DESC = 10_011,
SQL_ATTR_IMP_ROW_DESC = 10_012,
SQL_ATTR_IMP_PARAM_DESC = 10_013,
SQL_ATTR_CURSOR_SCROLLABLE = (-1),
SQL_ATTR_CURSOR_SENSITIVITY = (-2),

Expand Down Expand Up @@ -453,12 +453,12 @@ enum

enum
{
SQL_XOPEN_CLI_YEAR = 10000,
SQL_CURSOR_SENSITIVITY = 10001,
SQL_DESCRIBE_PARAMETER = 10002,
SQL_CATALOG_NAME = 10003,
SQL_COLLATION_SEQ = 10004,
SQL_MAX_IDENTIFIER_LEN = 10005,
SQL_XOPEN_CLI_YEAR = 10_000,
SQL_CURSOR_SENSITIVITY = 10_001,
SQL_DESCRIBE_PARAMETER = 10_002,
SQL_CATALOG_NAME = 10_003,
SQL_COLLATION_SEQ = 10_004,
SQL_MAX_IDENTIFIER_LEN = 10_005,
SQL_MAXIMUM_IDENTIFIER_LENGTH = SQL_MAX_IDENTIFIER_LEN
}

Expand Down
4 changes: 2 additions & 2 deletions etc/c/odbc/sqlext.d
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ enum
SQL_ALTER_DOMAIN = 117,
SQL_SQL_CONFORMANCE = 118,
SQL_DATETIME_LITERALS = 119,
SQL_ASYNC_MODE = 10021, /* new X/Open spec */
SQL_ASYNC_MODE = 10_021, /* new X/Open spec */
SQL_BATCH_ROW_COUNT = 120,
SQL_BATCH_SUPPORT = 121,
SQL_QUALIFIER_LOCATION = 114,
Expand Down Expand Up @@ -702,7 +702,7 @@ enum
SQL_INFO_SCHEMA_VIEWS = 149,
SQL_KEYSET_CURSOR_ATTRIBUTES1 = 150,
SQL_KEYSET_CURSOR_ATTRIBUTES2 = 151,
SQL_MAX_ASYNC_CONCURRENT_STATEMENTS = 10022, /* new X/Open spec */
SQL_MAX_ASYNC_CONCURRENT_STATEMENTS = 10_022, /* new X/Open spec */
SQL_ODBC_INTERFACE_CONFORMANCE = 152,
SQL_PARAM_ARRAY_ROW_COUNTS = 153,
SQL_PARAM_ARRAY_SELECTS = 154,
Expand Down
2 changes: 1 addition & 1 deletion etc/c/sqlite3.d
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern (C) __gshared nothrow:
*/
enum SQLITE_VERSION = "3.10.2";
/// Ditto
enum SQLITE_VERSION_NUMBER = 3010002;
enum SQLITE_VERSION_NUMBER = 3_010_002;
/// Ditto
enum SQLITE_SOURCE_ID = "2016-01-20 15:27:19 17efb4209f97fb4971656086b138599a91a75ff9";

Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/iteration.d
Original file line number Diff line number Diff line change
Expand Up @@ -3600,7 +3600,7 @@ The number of seeds must be correspondingly increased.
static if (DummyType.rt <= RangeType.Forward)
static assert(propagatesRangeType!(typeof(m), DummyType));

assert(m.equal([1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800]));
assert(m.equal([1, 2, 6, 24, 120, 720, 5040, 40_320, 362_880, 3_628_800]));
}
}

Expand Down
2 changes: 1 addition & 1 deletion std/datetime.d
Original file line number Diff line number Diff line change
Expand Up @@ -35242,7 +35242,7 @@ version(unittest)
sort(diffs);
testTZs = [diffAA[diffs[0]], diffAA[diffs[1]], diffAA[diffs[2]]];

testFracSecs = [Duration.zero, hnsecs(1), hnsecs(5007), hnsecs(9999999)];
testFracSecs = [Duration.zero, hnsecs(1), hnsecs(5007), hnsecs(9_999_999)];

foreach (year; testYearsBC)
{
Expand Down
2 changes: 1 addition & 1 deletion std/functional.d
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ template memoize(alias fun, uint maxSize)
else if (memo[idx1].args == args)
return memo[idx1].res;
// FNV prime
immutable idx2 = (hash * 16777619) % maxSize;
immutable idx2 = (hash * 16_777_619) % maxSize;
if (!bt(initialized.ptr, idx2))
{
emplace(&memo[idx2], memo[idx1]);
Expand Down
10 changes: 5 additions & 5 deletions std/internal/math/biguintcore.d
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ int highestPowerBelowUintMax(uint x) pure nothrow @safe
if (x<85) return 5;
if (x<256) return 4;
if (x<1626) return 3;
if (x<65536) return 2;
if (x<65_536) return 2;
return 1;
}

Expand All @@ -1167,8 +1167,8 @@ int highestPowerBelowUlongMax(uint x) pure nothrow @safe
if (x<566) return 7;
if (x<1626) return 6;
if (x<7132) return 5;
if (x<65536) return 4;
if (x<2642246) return 3;
if (x<65_536) return 4;
if (x<2_642_246) return 3;
return 2;
}

Expand Down Expand Up @@ -1753,9 +1753,9 @@ body
// Multiply existing number by 10^19, then add y1.
if (hi>0)
{
data[hi] = multibyteMul(data[0 .. hi], data[0 .. hi], 1220703125*2u, 0); // 5^13*2 = 0x9184_E72A
data[hi] = multibyteMul(data[0 .. hi], data[0 .. hi], 1_220_703_125*2u, 0); // 5^13*2 = 0x9184_E72A
++hi;
data[hi] = multibyteMul(data[0 .. hi], data[0 .. hi], 15625*262144u, 0); // 5^6*2^18 = 0xF424_0000
data[hi] = multibyteMul(data[0 .. hi], data[0 .. hi], 15_625*262_144u, 0); // 5^6*2^18 = 0xF424_0000
++hi;
}
else
Expand Down
2 changes: 1 addition & 1 deletion std/internal/math/errorfunction.d
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ real expx2(real x, int sign)
Cephes Math Library Release 2.9: June, 2000
Copyright 2000 by Stephen L. Moshier
*/
const real M = 32768.0;
const real M = 32_768.0;
const real MINV = 3.0517578125e-5L;

x = abs(x);
Expand Down
40 changes: 20 additions & 20 deletions std/internal/unicode_tables.d
Original file line number Diff line number Diff line change
Expand Up @@ -3815,36 +3815,36 @@ bool isFormatGen(dchar ch) @safe pure nothrow
else if (ch < 8293) return true;
else
{
if (ch < 69821)
if (ch < 69_821)
{
if (ch < 65279)
if (ch < 65_279)
{
if (ch < 8294) return false;
if (ch < 8304) return true;
return false;
}
else if (ch < 65280) return true;
else if (ch < 65_280) return true;
else
{
if (ch < 65529) return false;
if (ch < 65532) return true;
if (ch < 65_529) return false;
if (ch < 65_532) return true;
return false;
}
}
else if (ch < 69822) return true;
else if (ch < 69_822) return true;
else
{
if (ch < 917505)
if (ch < 917_505)
{
if (ch < 119155) return false;
if (ch < 119163) return true;
if (ch < 119_155) return false;
if (ch < 119_163) return true;
return false;
}
else if (ch < 917506) return true;
else if (ch < 917_506) return true;
else
{
if (ch < 917536) return false;
if (ch < 917632) return true;
if (ch < 917_536) return false;
if (ch < 917_632) return true;
return false;
}
}
Expand Down Expand Up @@ -3880,7 +3880,7 @@ bool isSpaceGen(dchar ch) @safe pure nothrow
else
{
if (ch == 8287) return true;
if (ch == 12288) return true;
if (ch == 12_288) return true;
return false;
}
}
Expand Down Expand Up @@ -3924,7 +3924,7 @@ bool isWhiteGen(dchar ch) @safe pure nothrow @nogc
else if (ch < 8288) return true;
else
{
if (ch == 12288) return true;
if (ch == 12_288) return true;
return false;
}
}
Expand All @@ -3935,26 +3935,26 @@ bool isHangL(dchar ch) @safe pure nothrow
{
if (ch < 4352) return false;
if (ch < 4448) return true;
if (ch < 43360) return false;
if (ch < 43389) return true;
if (ch < 43_360) return false;
if (ch < 43_389) return true;
return false;
}

bool isHangV(dchar ch) @safe pure nothrow
{
if (ch < 4448) return false;
if (ch < 4520) return true;
if (ch < 55216) return false;
if (ch < 55239) return true;
if (ch < 55_216) return false;
if (ch < 55_239) return true;
return false;
}

bool isHangT(dchar ch) @safe pure nothrow
{
if (ch < 4520) return false;
if (ch < 4608) return true;
if (ch < 55243) return false;
if (ch < 55292) return true;
if (ch < 55_243) return false;
if (ch < 55_292) return true;
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions std/math.d
Original file line number Diff line number Diff line change
Expand Up @@ -2160,8 +2160,8 @@ L_was_nan:
];

// Overflow and Underflow limits.
enum real OF = 16384.0L;
enum real UF = -16382.0L;
enum real OF = 16_384.0L;
enum real UF = -16_382.0L;

// Special cases. Raises an overflow or underflow flag accordingly,
// except in the case for CTFE, where there are no hardware controls.
Expand Down Expand Up @@ -6350,7 +6350,7 @@ if (isFloatingPoint!(F) && isFloatingPoint!(G))

// Integer power of x.
long iy = cast(long) y;
if (iy == y && fabs(y) < 32768.0)
if (iy == y && fabs(y) < 32_768.0)
return pow(x, iy);

real sign = 1.0;
Expand Down
4 changes: 2 additions & 2 deletions std/parallelism.d
Original file line number Diff line number Diff line change
Expand Up @@ -4545,11 +4545,11 @@ version(unittest)
{
struct __S_12733
{
invariant() { assert(checksum == 1234567890); }
invariant() { assert(checksum == 1_234_567_890); }
this(ulong u){n = u;}
void opAssign(__S_12733 s){this.n = s.n;}
ulong n;
ulong checksum = 1234567890;
ulong checksum = 1_234_567_890;
}

static auto __genPair_12733(ulong n) { return __S_12733(n); }
Expand Down
24 changes: 12 additions & 12 deletions std/random.d
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,9 @@ generator) that uses 16807 for the multiplier. $(D MinstdRand)
implements a variant that has slightly better spectral behavior by
using the multiplier 48271. Both generators are rather simplistic.
*/
alias MinstdRand0 = LinearCongruentialEngine!(uint, 16807, 0, 2147483647);
alias MinstdRand0 = LinearCongruentialEngine!(uint, 16_807, 0, 2_147_483_647);
/// ditto
alias MinstdRand = LinearCongruentialEngine!(uint, 48271, 0, 2147483647);
alias MinstdRand = LinearCongruentialEngine!(uint, 48_271, 0, 2_147_483_647);

///
@safe unittest
Expand Down Expand Up @@ -828,7 +828,7 @@ LinearCongruentialEngine) would be the generator of choice.
alias Mt19937 = MersenneTwisterEngine!(uint, 32, 624, 397, 31,
0x9908b0df, 11, 0xffffffff, 7,
0x9d2c5680, 15,
0xefc60000, 18, 1812433253);
0xefc60000, 18, 1_812_433_253);

///
@safe unittest
Expand Down Expand Up @@ -869,7 +869,7 @@ period of 2 to the power of 19937.
alias Mt19937_64 = MersenneTwisterEngine!(ulong, 64, 312, 156, 31,
0xb5026f5aa96619e9, 29, 0x5555555555555555, 17,
0x71d67fffeda60000, 37,
0xfff7eee000000000, 43, 6364136223846793005);
0xfff7eee000000000, 43, 6_364_136_223_846_793_005);

///
@safe unittest
Expand Down Expand Up @@ -1014,18 +1014,18 @@ if (isUnsigned!UIntType)
enum size = bits / 32;

static if (bits == 32)
UIntType[size] seeds_ = [2463534242];
UIntType[size] seeds_ = [2_463_534_242];
else static if (bits == 64)
UIntType[size] seeds_ = [123456789, 362436069];
UIntType[size] seeds_ = [123_456_789, 362_436_069];
else static if (bits == 96)
UIntType[size] seeds_ = [123456789, 362436069, 521288629];
UIntType[size] seeds_ = [123_456_789, 362_436_069, 521_288_629];
else static if (bits == 128)
UIntType[size] seeds_ = [123456789, 362436069, 521288629, 88675123];
UIntType[size] seeds_ = [123_456_789, 362_436_069, 521_288_629, 88_675_123];
else static if (bits == 160)
UIntType[size] seeds_ = [123456789, 362436069, 521288629, 88675123, 5783321];
UIntType[size] seeds_ = [123_456_789, 362_436_069, 521_288_629, 88_675_123, 5_783_321];
else static if (bits == 192)
{
UIntType[size] seeds_ = [123456789, 362436069, 521288629, 88675123, 5783321, 6615241];
UIntType[size] seeds_ = [123_456_789, 362_436_069, 521_288_629, 88_675_123, 5_783_321, 6_615_241];
UIntType value_;
}
else
Expand All @@ -1052,7 +1052,7 @@ if (isUnsigned!UIntType)
{
// Initialization routine from MersenneTwisterEngine.
foreach (i, e; seeds_)
seeds_[i] = x0 = cast(UIntType)(1812433253U * (x0 ^ (x0 >> 30)) + i + 1);
seeds_[i] = x0 = cast(UIntType)(1_812_433_253U * (x0 ^ (x0 >> 30)) + i + 1);

// All seeds must not be 0.
sanitizeSeeds(seeds_);
Expand Down Expand Up @@ -1125,7 +1125,7 @@ if (isUnsigned!UIntType)
seeds_[2] = seeds_[3];
seeds_[3] = seeds_[4];
seeds_[4] = seeds_[4] ^ (seeds_[4] << c) ^ temp ^ (temp << b);
value_ = seeds_[4] + (seeds_[5] += 362437);
value_ = seeds_[4] + (seeds_[5] += 362_437);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion std/zip.d
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ final class ZipArchive
throw new ZipException("zip files bigger than 4 GB are unsupported");

// Find 'end record index' by searching backwards for signature
iend = (data.length > 66000 ? to!uint(data.length - 66000) : 0);
iend = (data.length > 66_000 ? to!uint(data.length - 66_000) : 0);
for (i = to!uint(data.length) - 22; 1; i--)
{
if (i < iend || i >= data.length)
Expand Down

0 comments on commit 4ce5d44

Please sign in to comment.