Skip to content

Simplify generic Index* (and Compare*) further.

  1. Assuming that:
  • generic Index* and Compare* rely on wrapping pointer overflow anyway;

  • this overflow might happen only when calculating pend and not when iterating, and means unbounded iteration when you expect to find something (mainly, terminating #0) and are fine with UB otherwise;

  • strings don’t occupy half of the address space (so len = Low(SizeInt) and len = -1 are equivalent; actually, CompareWord doesn’t check that and interprets len = Low(SizeInt) as len = 0, len = Low(SizeInt) + 1 as len = 1 and so on — I changed this for consistency with others);

I think that anything related to pend < psrc can be removed, and conditions changed from psrc < pend to psrc <> pend.

  1. Even if PtrUintwise loop found a difference, lowering pend to psrc+sizeof(pointer) is pointless, loop that iterates over a single value will guaranteedly stumble into it again.

Patch: pend.patch.

Edited by Rika
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information