Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document STRUPR/STRLWR as ASCII-only #1187

Merged
merged 2 commits into from
Oct 31, 2023
Merged
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
4 changes: 2 additions & 2 deletions man/rgbasm.5
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ Most of them return a string, however some of these functions actually return an
.It Fn STRIN str1 str2 Ta Returns the first position of Ar str2 No in Ar str1 No or zero if it's not present Pq first character is position 1 .
.It Fn STRRIN str1 str2 Ta Returns the last position of Ar str2 No in Ar str1 No or zero if it's not present Pq first character is position 1 .
.It Fn STRSUB str pos len Ta Returns a substring from Ar str No starting at Ar pos No (first character is position 1, last is position -1) and Ar len No characters long. If Ar len No is not specified the substring continues to the end of Ar str .
.It Fn STRUPR str Ta Returns Ar str No with all letters in uppercase.
.It Fn STRLWR str Ta Returns Ar str No with all letters in lowercase.
.It Fn STRUPR str Ta Returns Ar str No with all ASCII letters (`a-z`) in uppercase.
.It Fn STRLWR str Ta Returns Ar str No with all ASCII letters (`A-Z`) in lowercase.
.It Fn STRRPL str old new Ta Returns Ar str No with each non-overlapping occurrence of the substring Ar old No replaced with Ar new .
.It Fn STRFMT fmt args... Ta Returns the string Ar fmt No with each
.Ql %spec
Expand Down
2 changes: 1 addition & 1 deletion src/asm/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,7 @@ z80_ldio : T_Z80_LDH T_MODE_A T_COMMA op_mem_ind {

c_ind : T_LBRACK T_MODE_C T_RBRACK
| T_LBRACK relocexpr T_OP_ADD T_MODE_C T_RBRACK {
if (!rpn_isKnown(&$2) || $2.val != 0xff00)
if (!rpn_isKnown(&$2) || $2.val != 0xFF00)
error("Expected constant expression equal to $FF00 for \"$ff00+c\"\n");
}
;
Expand Down
4 changes: 2 additions & 2 deletions src/asm/section.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static unsigned int mergeSectUnion(struct Section *sect, enum SectionType type,
!= (sect->alignOfs & mask(alignment))) {
fail("Section already declared with incompatible %u"
"-byte alignment (offset %" PRIu16 ")\n",
1u << sect->align, sect->alignOfs);
1U << sect->align, sect->alignOfs);
} else if (alignment > sect->align) {
// If the section is not fixed, its alignment is the largest of both
sect->align = alignment;
Expand Down Expand Up @@ -212,7 +212,7 @@ static unsigned int mergeFragments(struct Section *sect, enum SectionType type,
} else if ((curOfs & mask(sect->align)) != (sect->alignOfs & mask(alignment))) {
fail("Section already declared with incompatible %u"
"-byte alignment (offset %" PRIu16 ")\n",
1u << sect->align, sect->alignOfs);
1U << sect->align, sect->alignOfs);
} else if (alignment > sect->align) {
// If the section is not fixed, its alignment is the largest of both
sect->align = alignment;
Expand Down
2 changes: 1 addition & 1 deletion src/extern/getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static int getopt(int argc, char *argv[], char const *optstring)
k = mbtowc(&c, argv[musl_optind] + musl_optpos, MB_LEN_MAX);
if (k < 0) {
k = 1;
c = 0xfffd; /* replacement char */
c = 0xFFFD; /* replacement char */
}
optchar = argv[musl_optind] + musl_optpos;
musl_optpos += k;
Expand Down
4 changes: 2 additions & 2 deletions src/extern/utf8decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ uint32_t decode(uint32_t *state, uint32_t *codep, uint8_t byte)
uint32_t type = utf8d[byte];

*codep = (*state != 0) ?
(byte & 0x3fu) | (*codep << 6) :
(0xff >> type) & (byte);
(byte & 0x3FU) | (*codep << 6) :
(0xFF >> type) & (byte);

*state = utf8d[256 + *state * 16 + type];
return *state;
Expand Down
2 changes: 1 addition & 1 deletion src/gfx/reverse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void reverse() {
// TODO: -U

std::vector<std::array<Rgba, 4>> palettes{
{Rgba(0xffffffff), Rgba(0xaaaaaaff), Rgba(0x555555ff), Rgba(0x000000ff)}
{Rgba(0xFFFFFFFF), Rgba(0xAAAAAAFF), Rgba(0x555555FF), Rgba(0x000000FF)}
};
if (!options.palettes.empty()) {
File file;
Expand Down
2 changes: 1 addition & 1 deletion src/hashmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct HashMapEntry {
struct HashMapEntry *next;
};

#define FNV_OFFSET_BASIS 0x811c9dc5
#define FNV_OFFSET_BASIS 0x811C9DC5
#define FNV_PRIME 16777619

// FNV-1a hash
Expand Down
2 changes: 1 addition & 1 deletion test/gfx/randtilegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static unsigned long long getRandomBits(unsigned count) {
randbits |= (unsigned long long)data << randcount;
randcount += 8;
}
unsigned long long result = randbits & ((1ull << count) - 1);
unsigned long long result = randbits & ((1ULL << count) - 1);
randbits >>= count;
randcount -= count;
return result;
Expand Down