Decompile fn_18368 (FillMessageBuckets)

Batch #1207 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review.

- fn_18368 FillMessageBuckets: logic confirmed by peer review

Peer-reviewed-by: eAthena
Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-27 21:09:06 +00:00
commit bce0cc6603

View file

@ -60,6 +60,30 @@ namespace {
}
// OFFSET: 0x00B00360
// FUNCTION: fn_18368
int FillMessageBuckets(int* first, std::uintptr_t last, int* value) {
int result = 0;
int* dest = first;
unsigned int count = (last - reinterpret_cast<std::uintptr_t>(first) + 3) >> 2;
if (reinterpret_cast<std::uintptr_t>(first) > last) {
count = 0;
}
if (count >= 4) {
result = *value;
if (first > value || &first[count - 1] < value) {
unsigned int aligned = count & ~3u;
dest = &first[aligned];
for (int* p = first; p != dest; ++p) {
*p = result;
}
}
}
for (; dest != reinterpret_cast<int*>(last); ++dest) {
result = *value;
*dest = *value;
}
return result;
}
struct MessageBucketVector {
void* begin;