Differences From Artifact [63bde433c3]:
- File src/macros.h — part of check-in [dcff33c798] at 2016-10-08 15:57:37 on branch trunk — Implement scrypt (user: js, size: 14748) [annotate] [blame] [check-ins using]
To Artifact [49ab80b017]:
- File
src/macros.h
— part of check-in
[d9eb7b50b3]
at
2017-01-07 00:37:26
on branch trunk
— Add of_ascii_{to{upper,lower},is{alpha,alnum}}
These are independent of the locale and work on the ASCII character set.
Unlike the C ones, these are 8-bit safe, meaning if a character > 0x7F
is passed, is{alpha,alnum} returns false and to{upper,lower} returns the
original character. (user: js, size: 15181) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
605 606 607 608 609 610 611 | of_explicit_memset(void *buffer_, int character, size_t length) { volatile unsigned char *buffer = buffer_; while (buffer < (unsigned char*)buffer_ + length) *buffer++ = character; } | > > > > > > > > > > > > > > > > > > > > > > > > | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | of_explicit_memset(void *buffer_, int character, size_t length) { volatile unsigned char *buffer = buffer_; while (buffer < (unsigned char*)buffer_ + length) *buffer++ = character; } static OF_INLINE bool of_ascii_isalpha(char c) { return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); } static OF_INLINE bool of_ascii_isalnum(char c) { return (of_ascii_isalpha(c) || (c >= '0' && c <= '9')); } static OF_INLINE char of_ascii_toupper(char c) { return (c >= 'a' && c <= 'z' ? 'A' + (c - 'a') : c); } static OF_INLINE char of_ascii_tolower(char c) { return (c >= 'A' && c <= 'Z' ? 'a' + (c - 'A') : c); } |