Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions std/encoding.d
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,7 @@ Returns true if c is a valid code point
Params:
c = the code point to be tested
*/
pragma(inline, true)
bool isValidCodePoint(dchar c) @safe pure nothrow @nogc
{
return c < 0xD800 || (c >= 0xE000 && c < 0x110000);
Expand Down
5 changes: 4 additions & 1 deletion std/internal/unicode_tables.d
Original file line number Diff line number Diff line change
Expand Up @@ -2261,6 +2261,7 @@ bool isFormatGen(dchar ch) @safe pure nothrow @nogc
}
}

pragma(inline, true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is auto-generated by tools/unicode_table_generator.d, so it should be modified in the toSourceCode function at std/uni/package.d.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave this module alone please.

Unicode tables are one place where the value is much lower in inlining due to the cost of the algorithms that call them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll merge this once the pragmas are removed from this file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LightBender What's the answer to #10880 (comment) ?

bool isControlGen(dchar ch) @safe pure nothrow @nogc
{
if (ch < 32) return true;
Expand Down Expand Up @@ -2341,6 +2342,7 @@ bool isWhiteGen(dchar ch) @safe pure nothrow @nogc
}
}

pragma(inline, true)
bool isHangL(dchar ch) @safe pure nothrow @nogc
{
if (ch < 4352) return false;
Expand All @@ -2350,6 +2352,7 @@ bool isHangL(dchar ch) @safe pure nothrow @nogc
return false;
}

pragma(inline, true)
bool isHangV(dchar ch) @safe pure nothrow @nogc
{
if (ch < 4448) return false;
Expand All @@ -2359,6 +2362,7 @@ bool isHangV(dchar ch) @safe pure nothrow @nogc
return false;
}

pragma(inline, true)
bool isHangT(dchar ch) @safe pure nothrow @nogc
{
if (ch < 4520) return false;
Expand Down Expand Up @@ -8619,4 +8623,3 @@ return t;
}

}

1 change: 1 addition & 0 deletions std/math/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if (isFloatingPoint!(X))
{
version (all)
{
pragma(inline, true);
return x != x;
}
else
Expand Down
1 change: 1 addition & 0 deletions std/path.d
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ else static assert(0, "unsupported platform");
On Windows, this includes both $(D `\`) and $(D `/`).
On POSIX, it's just $(D `/`).
*/
pragma(inline, true)
bool isDirSeparator(dchar c) @safe pure nothrow @nogc
{
if (c == '/') return true;
Expand Down
11 changes: 11 additions & 0 deletions std/uni/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,7 @@ string genUnrolledSwitchSearch(size_t size) @safe pure nothrow
return code;
}

pragma(inline, true)
bool isPow2OrZero(size_t sz) @safe pure nothrow @nogc
{
// See also: std.math.isPowerOf2()
Expand Down Expand Up @@ -9161,6 +9162,7 @@ public bool isWhite(dchar c)
/++
Return whether `c` is a Unicode lowercase $(CHARACTER).
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isLower(dchar c)
{
Expand Down Expand Up @@ -9194,6 +9196,7 @@ bool isLower(dchar c)
/++
Return whether `c` is a Unicode uppercase $(CHARACTER).
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isUpper(dchar c)
{
Expand Down Expand Up @@ -10433,6 +10436,7 @@ if (!isSomeString!S && (isRandomAccessRange!S && hasLength!S && hasSlicing!S &&
Returns whether `c` is a Unicode alphabetic $(CHARACTER)
(general Unicode category: Alphabetic).
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isAlpha(dchar c)
{
Expand Down Expand Up @@ -10478,6 +10482,7 @@ bool isMark(dchar c)
Returns whether `c` is a Unicode numerical $(CHARACTER)
(general Unicode category: Nd, Nl, No).
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isNumber(dchar c)
{
Expand Down Expand Up @@ -10511,6 +10516,7 @@ bool isNumber(dchar c)
`true` if the character is in the Alphabetic, Nd, Nl, or No Unicode
categories
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isAlphaNum(dchar c)
{
Expand Down Expand Up @@ -10548,6 +10554,7 @@ bool isAlphaNum(dchar c)
Returns whether `c` is a Unicode punctuation $(CHARACTER)
(general Unicode category: Pd, Ps, Pe, Pc, Po, Pi, Pf).
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isPunctuation(dchar c)
{
Expand Down Expand Up @@ -10695,6 +10702,7 @@ bool isFormat(dchar c)
Returns whether `c` is a Unicode Private Use $(CODEPOINT)
(general Unicode category: Co).
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isPrivateUse(dchar c)
{
Expand All @@ -10707,6 +10715,7 @@ bool isPrivateUse(dchar c)
Returns whether `c` is a Unicode surrogate $(CODEPOINT)
(general Unicode category: Cs).
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isSurrogate(dchar c)
{
Expand All @@ -10716,6 +10725,7 @@ bool isSurrogate(dchar c)
/++
Returns whether `c` is a Unicode high surrogate (lead surrogate).
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isSurrogateHi(dchar c)
{
Expand All @@ -10725,6 +10735,7 @@ bool isSurrogateHi(dchar c)
/++
Returns whether `c` is a Unicode low surrogate (trail surrogate).
+/
pragma(inline, true)
@safe pure nothrow @nogc
bool isSurrogateLo(dchar c)
{
Expand Down
4 changes: 3 additions & 1 deletion std/utf.d
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ if (isSomeChar!Char)
`'\uFFFE'` and `'\uFFFF'` are considered valid by `isValidDchar`,
as they are permitted for internal use by an application, but they are
not allowed for interchange by the Unicode standard.
+/
+/
pragma(inline, true)
bool isValidDchar(dchar c) pure nothrow @safe @nogc
{
return c < 0xD800 || (c > 0xDFFF && c <= 0x10FFFF);
Expand Down Expand Up @@ -325,6 +326,7 @@ Params:
Returns:
`true`, if `c` forms a valid code point.
*/
pragma(inline, true)
bool isValidCodepoint(Char)(Char c)
if (isSomeChar!Char)
{
Expand Down
Loading