Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c15b3a37656b7e6d2097c69ea07ce2a1c023db2f
https://github.com/WebKit/WebKit/commit/c15b3a37656b7e6d2097c69ea07ce2a1c023db2f
Author: Chris Dumez <[email protected]>
Date: 2026-06-24 (Wed, 24 Jun 2026)
Changed paths:
M Source/JavaScriptCore/heap/Heap.cpp
M Source/JavaScriptCore/heap/SlotVisitorInlines.h
M Source/WTF/WTF.xcodeproj/project.pbxproj
M Source/WTF/wtf/CMakeLists.txt
R Source/WTF/wtf/SaturatedArithmetic.h
A Source/WTF/wtf/SaturatingArithmetic.h
M Source/WTF/wtf/text/StringBuilder.cpp
M Source/WTF/wtf/text/StringBuilder.h
M Source/WTF/wtf/text/StringBuilderJSON.cpp
M Source/WebCore/platform/LayoutUnit.h
M Source/WebCore/rendering/RenderCounter.cpp
M Source/WebCore/style/computed/StyleComputedStyleBase.cpp
M Source/WebKit/Shared/EditingRange.h
M Tools/TestWebKitAPI/CMakeLists.txt
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
R Tools/TestWebKitAPI/Tests/WTF/SaturatedArithmeticOperations.cpp
A Tools/TestWebKitAPI/Tests/WTF/SaturatingArithmeticOperations.cpp
Log Message:
-----------
Rename SaturatedArithmetic.h and its APIs to "Saturating" for clarity
https://bugs.webkit.org/show_bug.cgi?id=317713
Reviewed by Darin Adler.
Rename SaturatedArithmetic.h to SaturatingArithmetic.h and rename its
APIs from "saturated" to "saturating" (saturatedSum -> saturatingSum,
saturatedDifference -> saturatingDifference) for clarity, updating all
call sites accordingly.
"Saturating" describes the operation, whereas "saturated" describes a
state. These functions perform an operation that saturates on overflow;
they clamp only when needed and otherwise return the ordinary result.
Naming them after the behavior ("saturating") is therefore more accurate
than naming them after the one possible end-state ("saturated").
This also matches established convention: the canonical term is
"saturation arithmetic", and the operation is named with the
"saturating" form elsewhere (e.g. C++26's std::saturating_add /
std::saturating_sub in <numeric>, and Rust's saturating_add /
saturating_sub). Notably, C++26's own documentation names the function
saturating_add (the operation) while describing a clamped result as
"saturated" (the state) -- the same distinction drawn above. The header
was already named SaturatingArithmetic.h, so this makes the file and its
contents consistent.
* Source/JavaScriptCore/heap/Heap.cpp:
* Source/JavaScriptCore/heap/SlotVisitorInlines.h:
Update FIXME comments to refer to SaturatingArithmetic.
* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/SaturatingArithmetic.h: Renamed from
Source/WTF/wtf/SaturatedArithmetic.h.
(WTF::signedAddInt32Overflows):
(WTF::saturatingSum<int32_t>):
(WTF::signedSubtractInt32Overflows):
(WTF::saturatingDifference<int32_t>):
(WTF::saturatingSum):
* Source/WTF/wtf/text/StringBuilder.cpp:
* Source/WTF/wtf/text/StringBuilder.h:
* Source/WTF/wtf/text/StringBuilderJSON.cpp:
* Source/WebCore/platform/LayoutUnit.h:
* Source/WebCore/rendering/RenderCounter.cpp:
* Source/WebCore/style/computed/StyleComputedStyleBase.cpp:
* Source/WebKit/Shared/EditingRange.h:
Update call sites to use the renamed APIs.
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WTF/SaturatingArithmeticOperations.cpp: Renamed
from Tools/TestWebKitAPI/Tests/WTF/SaturatedArithmeticOperations.cpp.
Canonical link: https://commits.webkit.org/315787@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications