diff options
author | Zufu Liu <unknown> | 2024-03-11 09:16:24 +1100 |
---|---|---|
committer | Zufu Liu <unknown> | 2024-03-11 09:16:24 +1100 |
commit | f4ba63335f039d9632f157614cff92d35b14dfa4 (patch) | |
tree | 34454ae61ca76c132290d675a53f16a6512b36e2 | |
parent | 456e40e7f8e1dde98a7127b0463f7ae8b6c6e88b (diff) | |
download | scintilla-mirror-f4ba63335f039d9632f157614cff92d35b14dfa4.tar.gz |
Feature [feature-requests:#1512]. Simplify WriteValue.
-rw-r--r-- | src/UndoHistory.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/UndoHistory.cxx b/src/UndoHistory.cxx index daae97ad5..70a50b870 100644 --- a/src/UndoHistory.cxx +++ b/src/UndoHistory.cxx @@ -54,8 +54,9 @@ size_t ReadValue(const uint8_t *bytes, size_t length) noexcept { } void WriteValue(uint8_t *bytes, size_t length, size_t value) noexcept { - for (size_t i = 0; i < length; i++) { - bytes[length - i - 1] = value & byteMask; + while (length != 0) { + --length; + bytes[length] = value & byteMask; value = value >> byteBits; } } |