Home
last modified time | relevance | path

Searched refs:CheckedNumeric (Results 1 – 25 of 67) sorted by relevance

123

/external/angle/src/common/third_party/base/anglebase/numerics/
Dsafe_math.h55 class CheckedNumeric
62 CheckedNumeric() {} in CheckedNumeric() function
66 CheckedNumeric(const CheckedNumeric<Src> &rhs) : state_(rhs.ValueUnsafe(), rhs.validity()) in CheckedNumeric() function
70 CheckedNumeric(Src value, RangeConstraint validity) : state_(value, validity) in CheckedNumeric() function
76 CheckedNumeric(Src value) // NOLINT(runtime/explicit) in CheckedNumeric() function
85 CheckedNumeric(StrictNumeric<Src> value) // NOLINT(runtime/explicit) in CheckedNumeric() function
119 return CheckedNumeric<T>::cast(*this).ValueUnsafe(); in ValueFloating()
142 CheckedNumeric &operator+=(Src rhs);
144 CheckedNumeric &operator-=(Src rhs);
146 CheckedNumeric &operator*=(Src rhs);
[all …]
Dsafe_numerics_unittest.cc22 using base::CheckedNumeric;
68 EXPECT_EQ(expected, CheckedNumeric<Dst>(actual).IsValid()) \
76 EXPECT_EQ(static_cast<Dst>(expected), CheckedNumeric<Dst>(actual).ValueUnsafe()) \
89 TEST_EXPECTED_FAILURE(-CheckedNumeric<Dst>(DstLimits::min())); in TestSpecializedArithmetic()
90 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()).Abs()); in TestSpecializedArithmetic()
91 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(-1).Abs()); in TestSpecializedArithmetic()
93 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + -1); in TestSpecializedArithmetic()
94 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) + -1); in TestSpecializedArithmetic()
95 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(-DstLimits::max()) + -DstLimits::max()); in TestSpecializedArithmetic()
97 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::min()) - 1); in TestSpecializedArithmetic()
[all …]
/external/libchrome/base/numerics/
Dchecked_math.h19 class CheckedNumeric {
26 constexpr CheckedNumeric() = default;
30 constexpr CheckedNumeric(const CheckedNumeric<Src>& rhs) in CheckedNumeric() function
34 friend class CheckedNumeric; variable
39 constexpr CheckedNumeric(Src value) // NOLINT(runtime/explicit) in CheckedNumeric() function
47 constexpr CheckedNumeric( in CheckedNumeric() function
108 constexpr CheckedNumeric<typename UnderlyingType<Dst>::type> Cast() const { in Cast()
116 friend U GetNumericValueForTest(const CheckedNumeric<U>& src);
120 constexpr CheckedNumeric& operator+=(const Src rhs);
122 constexpr CheckedNumeric& operator-=(const Src rhs);
[all …]
DREADME.md10 * `checked_math.h` contains the `CheckedNumeric` template class and helper
26 * `StrictNumeric` coerces to `ClampedNumeric` and `CheckedNumeric`
27 * `ClampedNumeric` coerces to `CheckedNumeric`
105 other boundary conditions. The `CheckedNumeric` template does this by storing
111 Here's an example of a buffer calculation using a `CheckedNumeric` type (note:
201 values extracted from a `CheckedNumeric` class instance. The raw numeric value
209 ## CheckedNumeric<> in checked_math.h
211 `CheckedNumeric<>` implements all the logic and operators for detecting integer
213 The `CheckedNumeric` type implicitly converts from floating point and integer
234 `CheckedNumeric` as a result of the operation:
[all …]
/external/pdfium/third_party/base/numerics/
Dsafe_math.h96 class CheckedNumeric {
103 constexpr CheckedNumeric() = default;
107 constexpr CheckedNumeric(const CheckedNumeric<Src>& rhs) in CheckedNumeric() function
111 friend class CheckedNumeric; variable
116 constexpr CheckedNumeric(Src value) // NOLINT(runtime/explicit) in CheckedNumeric() function
124 constexpr CheckedNumeric( in CheckedNumeric() function
176 constexpr CheckedNumeric<typename UnderlyingType<Dst>::type> Cast() const { in Cast()
184 friend U GetNumericValueForTest(const CheckedNumeric<U>& src);
188 CheckedNumeric& operator+=(const Src rhs);
190 CheckedNumeric& operator-=(const Src rhs);
[all …]
/external/libchrome/base/
Dsafe_numerics_unittest.cc115 U GetNumericValueForTest(const CheckedNumeric<U>& src) { in GetNumericValueForTest()
149 constexpr T GetValue(const CheckedNumeric<T>& src) { in GetValue()
154 constexpr T GetValueAsDest(const CheckedNumeric<U>& src) { in GetValueAsDest()
209 TEST_EXPECTED_FAILURE(-CheckedNumeric<Dst>(DstLimits::lowest())); in TestSpecializedArithmetic()
210 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()).Abs()); in TestSpecializedArithmetic()
211 TEST_EXPECTED_VALUE(1, CheckedNumeric<Dst>(-1).Abs()); in TestSpecializedArithmetic()
223 TEST_EXPECTED_SUCCESS(CheckedNumeric<Dst>(DstLimits::max()) + -1); in TestSpecializedArithmetic()
224 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) + -1); in TestSpecializedArithmetic()
225 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) + in TestSpecializedArithmetic()
236 TEST_EXPECTED_FAILURE(CheckedNumeric<Dst>(DstLimits::lowest()) - 1); in TestSpecializedArithmetic()
[all …]
Dbase64url.cc81 CheckedNumeric<size_t> base64_input_size = input.size(); in Base64UrlDecode()
/external/pdfium/core/fxcrt/
Dfx_safe_types.h13 using FX_SAFE_UINT32 = pdfium::base::CheckedNumeric<uint32_t>;
14 using FX_SAFE_INT32 = pdfium::base::CheckedNumeric<int32_t>;
15 using FX_SAFE_SIZE_T = pdfium::base::CheckedNumeric<size_t>;
16 using FX_SAFE_FILESIZE = pdfium::base::CheckedNumeric<FX_FILESIZE>;
/external/angle/src/libANGLE/
DVertexAttribute.cpp93 angle::CheckedNumeric<GLint64> bufferSize(buffer->getSize()); in updateCachedElementLimit()
94 angle::CheckedNumeric<GLint64> bufferOffset(binding.getOffset()); in updateCachedElementLimit()
95 angle::CheckedNumeric<GLint64> attribOffset(relativeOffset); in updateCachedElementLimit()
96 angle::CheckedNumeric<GLint64> attribSize(ComputeVertexAttributeTypeSize(*this)); in updateCachedElementLimit()
99 angle::CheckedNumeric<GLint64> elementLimit = in updateCachedElementLimit()
123 angle::CheckedNumeric<GLint64> bindingStride(binding.getStride()); in updateCachedElementLimit()
129 angle::CheckedNumeric<GLint64> bindingDivisor(binding.getDivisor()); in updateCachedElementLimit()
Dangletypes.cpp655 angle::CheckedNumeric<int> sourceX2(source.x); in ClipRectangle()
661 angle::CheckedNumeric<int> sourceY2(source.y); in ClipRectangle()
672 angle::CheckedNumeric<int> clipX2(clip.x); in ClipRectangle()
678 angle::CheckedNumeric<int> clipY2(clip.y); in ClipRectangle()
716 ASSERT((angle::CheckedNumeric<int>(rect1.x) + rect1.width).IsValid()); in GetEnclosingRectangle()
717 ASSERT((angle::CheckedNumeric<int>(rect1.y) + rect1.height).IsValid()); in GetEnclosingRectangle()
718 ASSERT((angle::CheckedNumeric<int>(rect2.x) + rect2.width).IsValid()); in GetEnclosingRectangle()
719 ASSERT((angle::CheckedNumeric<int>(rect2.y) + rect2.height).IsValid()); in GetEnclosingRectangle()
761 ASSERT((angle::CheckedNumeric<int>(source.x) + source.width).IsValid()); in ExtendRectangle()
762 ASSERT((angle::CheckedNumeric<int>(source.y) + source.height).IsValid()); in ExtendRectangle()
[all …]
DBinaryStream.h111 angle::CheckedNumeric<size_t> checkedOffset(mOffset); in readString()
133 angle::CheckedNumeric<size_t> checkedOffset(mOffset); in skip()
169 angle::CheckedNumeric<size_t> checkedLength(num); in read()
177 angle::CheckedNumeric<size_t> checkedOffset(mOffset); in read()
DTransformFeedback.cpp23 angle::CheckedNumeric<GLsizeiptr> GetVerticesNeededForDraw(PrimitiveMode primitiveMode, in GetVerticesNeededForDraw()
33 angle::CheckedNumeric<GLsizeiptr> checkedCount = count; in GetVerticesNeededForDraw()
34 angle::CheckedNumeric<GLsizeiptr> checkedPrimcount = primcount; in GetVerticesNeededForDraw()
Dformatutils.cpp29 bool CheckedMathResult(const CheckedNumeric<GLuint> &value, GLuint *resultOut) in CheckedMathResult()
1490 CheckedNumeric<GLuint> checkedWidth(width); in computeBufferRowLength()
1494 angle::CheckedNumeric<uint32_t> checkedRowLength = in computeBufferRowLength()
1505 CheckedNumeric<GLuint> checkedHeight(height); in computeBufferImageHeight()
1509 angle::CheckedNumeric<uint32_t> checkedImageHeight = in computeBufferImageHeight()
1531 CheckedNumeric<GLuint> checkedWidth(rowLength > 0 ? rowLength : width); in computeRowPitch()
1532 CheckedNumeric<GLuint> checkedRowBytes = checkedWidth * computePixelBytes(formatType); in computeRowPitch()
1535 CheckedNumeric<GLuint> checkedAlignment(alignment); in computeRowPitch()
1545 CheckedNumeric<GLuint> pixelsHeight(imageHeight > 0 ? static_cast<GLuint>(imageHeight) in computeDepthPitch()
1548 CheckedNumeric<GLuint> rowCount; in computeDepthPitch()
[all …]
/external/libchrome/base/time/
Dtime_exploded_posix.cc169 CheckedNumeric<int> month = exploded.month; in FromExploded()
171 CheckedNumeric<int> year = exploded.year; in FromExploded()
262 base::CheckedNumeric<int64_t> checked_millis = seconds; in FromExploded()
273 base::CheckedNumeric<int64_t> checked_microseconds_win_epoch = milliseconds; in FromExploded()
Dtime_now_posix.cc37 base::CheckedNumeric<int64_t> result(ts.tv_sec); in ConvertTimespecToMicros()
/external/pdfium/third_party/agg23/
D0002-ubsan-error-fixes.patch20 + pdfium::base::CheckedNumeric<float> width = x2;
24 + pdfium::base::CheckedNumeric<float> height = y2;
Dagg_clip_liang_barsky.h41 pdfium::base::CheckedNumeric<float> width = x2; in clip_liang_barsky()
45 pdfium::base::CheckedNumeric<float> height = y2; in clip_liang_barsky()
/external/angle/src/libANGLE/renderer/d3d/
DVertexDataManager.cpp45 CheckedNumeric<int64_t> stride = ComputeVertexAttributeStride(attrib, binding); in GetMaxAttributeByteOffsetForDraw()
46 CheckedNumeric<int64_t> offset = ComputeVertexAttributeOffset(attrib, binding); in GetMaxAttributeByteOffsetForDraw()
47 CheckedNumeric<int64_t> size = ComputeVertexAttributeTypeSize(attrib); in GetMaxAttributeByteOffsetForDraw()
51 CheckedNumeric<int64_t> result = in GetMaxAttributeByteOffsetForDraw()
52 stride * (CheckedNumeric<int64_t>(elementCount) - 1) + size + offset; in GetMaxAttributeByteOffsetForDraw()
155 CheckedNumeric<unsigned int> offset(baseOffset); in computeOffset()
156 CheckedNumeric<unsigned int> checkedStride(stride); in computeOffset()
401 CheckedNumeric<unsigned int> checkedOffset(streamOffset); in StoreStaticAttrib()
/external/libbrillo/brillo/
Dbackoff_entry.cc141 base::internal::CheckedNumeric<int64_t> calculated_release_time_us = in CalculateReleaseTime()
147 base::internal::CheckedNumeric<int64_t> maximum_release_time_us = kMaxTime; in CalculateReleaseTime()
/external/libchrome/ui/gfx/geometry/
Dsize.cc54 base::CheckedNumeric<int> Size::GetCheckedArea() const { in GetCheckedArea()
55 base::CheckedNumeric<int> checked_area = width(); in GetCheckedArea()
Dsize.h53 base::CheckedNumeric<int> GetCheckedArea() const;
/external/pdfium/fpdfsdk/
Dfpdf_structtree.cpp56 pdfium::base::CheckedNumeric<int> tmp_size = tree->CountTopElements(); in FPDF_StructTree_CountChildren()
116 pdfium::base::CheckedNumeric<int> tmp_size = elem->CountKids(); in FPDF_StructElement_CountChildren()
/external/libchrome/mojo/core/ports/
Devent.cc164 base::CheckedNumeric<size_t> port_data_size = data->num_ports; in Deserialize()
169 base::CheckedNumeric<size_t> total_size = port_data_size.ValueOrDie(); in Deserialize()
200 base::CheckedNumeric<size_t> size = sizeof(UserMessageEventData); in GetSerializedDataSize()
201 base::CheckedNumeric<size_t> ports_size = in GetSerializedDataSize()
/external/libchrome/mojo/core/
Duser_message_impl.cc116 base::CheckedNumeric<size_t> safe_header_size = num_new_dispatchers; in CreateOrExtendSerializedEventMessage()
200 base::CheckedNumeric<uint32_t>(total_num_dispatchers).ValueOrDie(); in CreateOrExtendSerializedEventMessage()
598 base::CheckedNumeric<size_t> next_payload_index = data_payload_index; in ExtractSerializedHandles()
605 base::CheckedNumeric<size_t> next_port_index = port_index; in ExtractSerializedHandles()
612 base::CheckedNumeric<size_t> next_platform_handle_index = in ExtractSerializedHandles()
/external/v4l2_codec2/common/
DCommon.cpp22 base::CheckedNumeric<int> checked_area = size.width; in getArea()

123