Commit graph

60 commits

Author SHA1 Message Date
deadalnix
60b78df799
Optimize isHexDigit (#8597) 2022-10-13 10:49:06 +08:00
deadalnix
ab74cf6708 Improve isAlphaNum
Using recent version of LDC, here are the codegen I get:
```
        lea     eax, [rdi - 48]
        cmp     eax, 74
        ja      .LBB2_1
        lea     ecx, [rdi - 97]
        mov     al, 1
        cmp     ecx, -39
        jb      .LBB2_4
        add     edi, -65
        cmp     edi, 26
        setb    al
.LBB2_4:
        ret
.LBB2_1:
        xor     eax, eax
        ret
```

And now:
```
        lea     eax, [rdi - 48]
        cmp     eax, 9
        setb    cl
        or      edi, 32
        add     edi, -97
        cmp     edi, 26
        setb    al
        or      al, cl
        ret
```

Which is much better all around: less instructions, no branches, etc...

I will note that doing `isDigit(c) || isAlpha(c)` also gives me good codegen using LDC, but I chose against it as DMD fails to inline properly and the end result is pretty bad.
2022-10-12 23:30:09 +02:00
Nathan Sashihara
99e390486c Reduce the number of isAggregateType!T checks
Some are redundant. Others can be replaced by cheaper traits checks.
2020-08-18 03:50:12 +02:00
Andrei Alexandrescu
fb2b57b284 [TRIVIAL] Make link clickable and safe (#7045)
[TRIVIAL] Make link clickable and safe
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-05-27 17:35:26 +02:00
dukc
332cf5b1f3 ControlChar member typos: sI -> si, sO -> so 2019-05-27 14:44:27 +03:00
dukc
09b847e1f2 Link to ascii table 2019-05-24 11:03:09 +03:00
dukc
c36d609f01 Unittest loop over first 32 control chars to ensure they are lined up. 2019-05-17 14:30:57 +03:00
dukc
778e307816 Character abbveriation to lowercase according to style guide. 2019-05-16 22:53:47 +03:00
dukc
6af0f68058 Added an enumerated type of ASCII control character. 2019-05-16 18:19:06 +03:00
Iain Buclaw
fd5facfe04 posix.mak: Enforce whitespace before opening parenthesis for version conditions 2018-09-22 16:57:24 +02:00
Sebastian Wilzbach
c324714fde Remove a few cases of underscore escaping 2018-06-04 13:05:01 +02:00
Steven Schveighoffer
adaba541eb Remove version(unittest) imports to avoid extra imports in user code. 2018-04-12 15:46:56 -04:00
Sebastian Wilzbach
42894784dd Markdownify Phobos
$(D word) -> `word`
2018-04-02 22:32:47 +02:00
Sebastian Wilzbach
e3b3b81afe Remove use of the deprecated std.digest.digest from std.ascii 2018-03-17 11:02:57 +01:00
Jonathan M Davis
1436fca1cc Add website link to author name for Jonathan M Davis. 2018-03-10 16:31:23 -07:00
Jack Stouffer
663b5b9278 Revert addition of StdUnittest 2018-02-20 13:32:32 -05:00
Jack Stouffer
18cbb29b04 Replaced version(unittest) blocks with version(StdUnittest) 2018-02-01 19:56:59 -05:00
The Dlang Bot
f3189822ab
Merge pull request #5989 from wilzbach/static-foreach
Use static foreach in Phobos
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
2018-01-03 19:05:07 +01:00
Sebastian Wilzbach
7de3787876 Use static foreach in Phobos 2018-01-03 17:30:11 +01:00
Sebastian Wilzbach
b0575c8a66 @safeify more unittests II 2018-01-03 06:26:05 +01:00
Sebastian Wilzbach
cc80b5715f has_public_example: std.ascii 2017-07-10 02:28:28 +02:00
Sebastian Wilzbach
ff8971dea3 [BOOKTABLES]: Add BOOKTABLE to std.ascii 2017-03-01 08:29:04 +01:00
Sebastian Wilzbach
425ab667a3 Automatically set the range style from a..b -> a .. b
Commands:

sed -E "s/([[:alnum:]])[.][.]([[:alnum:]])/\1 .. \2/g" -i **/*.d
sed -E "s/([[:alnum:]])[.][.] ([[:alnum:]])/\1 .. \2/g" -i **/*.d
sed -E "s/([[:alnum:]]) [.][.]([[:alnum:]])/\1 .. \2/g" -i **/*.d
2017-02-22 05:37:31 +01:00
Sebastian Wilzbach
805c720595 Unify Phobos by ensuring there's always a space after cast(...)
Command:

sed -E 's/([^"])cast\(([^)]*?)\)([[:alnum:]])/\1cast(\2) \3/g' -i **/*.d
2017-02-21 16:40:20 +01:00
Sebastian Wilzbach
87dec58a41 DStyle: Constraints on declarations should have the same indentation level 2017-02-17 07:36:23 +01:00
Atila Neves
a4a8174e3a Add @safe to std.ascii unittests 2016-06-29 13:58:48 +02:00
Sebastian Wilzbach
ec47ac4224 Remove the WEB macro in favor of HTTP
replacement: sed 's/\$(WEB/\$(HTTP/g' -i **/*.d
2016-06-16 00:14:51 +02:00
Sebastian Wilzbach
6dbd9dbe7e remove invalid copyright notices 2016-05-31 15:26:10 +02:00
Sebastian Wilzbach
18b8abf60a remove the deprecated wiki macros 2016-05-27 05:52:23 +02:00
Sebastian Wilzbach
89a2dd5f11 use mref macro instead of link2 2016-05-16 03:30:08 +03:00
Sebastian Wilzbach
3d67cd228c style fix: space between operators 2016-04-26 22:26:20 +03:00
Jack Stouffer
81ac05e6ab Force inlining of isASCII 2016-04-19 21:51:44 -04:00
Dragos Carp
d698887729 Remove obsolete TypeTuple references
Replace following names:
std.typetuple      -> std.meta
TypeTuple          -> AliasSeq
ParameterTypeTuple -> Parameters
FieldTypeTuple     -> Fields

std.traits requires more work than search/replace and is left unchanged.
2015-10-13 20:37:44 +02:00
Walter Bright
d9a9826e55 Revert "Introducing std.meta package" 2015-05-06 14:36:45 -07:00
Dicebot
82f54a38d3 TypeTuple -> MetaList inside Phobos 2015-05-05 22:22:11 +03:00
Dicebot
73f773838d import std.typetuple -> import std.meta 2015-05-05 22:22:10 +03:00
H. S. Teoh
c92d93147a Fix unittest attributes. 2015-03-18 16:14:29 -07:00
H. S. Teoh
4194dfa1ce Fixup based on feedback. 2015-03-18 16:12:37 -07:00
H. S. Teoh
a5c729d660 Add Params:.
Improve wording.
2015-03-18 15:34:49 -07:00
H. S. Teoh
bf5f1bb996 Improve std.ascii docs.
Add code examples.

Add Returns: tags to function descriptions.

Fix wrong highlighting of some words that coincide with symbol names.
2015-03-18 15:29:11 -07:00
jmdavis
64a8ad9cef Minor stylistic cleanup in std.ascii. 2014-05-22 16:08:27 -07:00
jmdavis
c8b472c526 Small code reduction in std.ascii.
We can have the comment only once, and it will still show up in the
docs.
2014-05-22 16:06:43 -07:00
Walter Bright
f10bf25346 add @nogc annotations to std.ascii 2014-05-05 17:42:22 -07:00
Walter Bright
a5bfcdefde improve optimization potential of std.ascii 2013-10-16 16:12:46 -07:00
Orvid King
6bb4e40a89 Properly scoped and selected the import of std.traits in std.ascii, so that it is only imported for the 2 functions that use it, toLower and toUpper.
There are also a couple of style changes, namely the ordering of values in an anonymous enum, and the use of only 1 indent level within an array declaration. The final change is to mark toLower and toUpper explicitly as @safe pure nothrow, as these are checked in unittests, but a unittest wouldn't tell you what was causing one of the attributes to not be valid for them.
2013-10-03 10:02:01 -05:00
monarchdodra
287cd873a3 rework toUpper/toLower unittests 2013-09-22 18:28:46 +02:00
monarchdodra
978250b3aa Fix Issue 10717 - std.ascii.toLower and toUpper should return char instead of dchar and avoid me to use a bad cast(char)
It turns out it was incorrectly working for enum types.

New semantics are that enums are also accepted, and their OriginalType is returned.
2013-09-21 11:28:37 +02:00
jmdavis
28c1a8480a Fix issue# 10717.
This makes it so that if you're operating on chars or wchars with
std.ascii functions, you don't have to cast the return values back to
char or wchar, but it still allows you to operate on dchars without
mangling any Unicode values.
2013-07-28 14:37:30 -07:00
Kozzi11
923b79998f Add LetterCase to to! 2013-07-22 15:29:34 +02:00
Kozzi11
d3922ea6ab Add possibility to set letter case in toHexString helper function 2013-07-18 13:23:04 +02:00