Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
safe_conversions_arm_impl.h
Go to the documentation of this file.
1
// Copyright 2024 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#
ifndef
CORE_FXCRT_NUMERICS_SAFE_CONVERSIONS_ARM_IMPL_H_
6
#
define
CORE_FXCRT_NUMERICS_SAFE_CONVERSIONS_ARM_IMPL_H_
7
8
#
include
<
cassert
>
9
#
include
<
limits
>
10
#
include
<
type_traits
>
11
12
#
include
"core/fxcrt/numerics/safe_conversions_impl.h"
13
14
namespace
pdfium
{
15
namespace
internal
{
16
17
// Fast saturation to a destination type.
18
template
<
typename
Dst,
typename
Src>
19
struct
SaturateFastAsmOp
{
20
static
constexpr
bool
is_supported
=
21
kEnableAsmCode
&&
std
::is_signed<Src>::value &&
22
std
::is_integral<Dst>::value &&
std
::is_integral<Src>::value &&
23
IntegerBitsPlusSign
<Src>::value <=
IntegerBitsPlusSign
<
int32_t
>
::
value
&&
24
IntegerBitsPlusSign
<Dst>::value <=
IntegerBitsPlusSign
<
int32_t
>
::
value
&&
25
!
IsTypeInRangeForNumericType
<Dst, Src>::value;
26
27
__attribute__
((always_inline))
static
Dst
Do
(Src value) {
28
int32_t src = value;
29
typename
std
::conditional<
std
::is_signed<Dst>::value, int32_t,
30
uint32_t>::type result;
31
if
(
std
::is_signed<Dst>::value) {
32
asm
(
"ssat %[dst], %[shift], %[src]"
33
: [dst]
"=r"
(result)
34
: [src]
"r"
(src), [shift]
"n"
(
IntegerBitsPlusSign
<Dst>::value <= 32
35
?
IntegerBitsPlusSign
<Dst>::value
36
: 32));
37
}
else
{
38
asm
(
"usat %[dst], %[shift], %[src]"
39
: [dst]
"=r"
(result)
40
: [src]
"r"
(src), [shift]
"n"
(
IntegerBitsPlusSign
<Dst>::value < 32
41
?
IntegerBitsPlusSign
<Dst>::value
42
: 31));
43
}
44
return
static_cast
<Dst>(result);
45
}
46
};
47
48
}
// namespace internal
49
}
// namespace pdfium
50
51
#
endif
// CORE_FXCRT_NUMERICS_SAFE_CONVERSIONS_ARM_IMPL_H_
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
pdfium::internal
Definition
span.h:34
pdfium::internal::kEnableAsmCode
constexpr bool kEnableAsmCode
Definition
safe_conversions_impl.h:99
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
pdfium::internal::IntegerBitsPlusSign
Definition
safe_conversions_impl.h:36
pdfium::internal::IntegerBitsPlusSign::value
static const int value
Definition
safe_conversions_impl.h:37
pdfium::internal::IsTypeInRangeForNumericType
Definition
safe_conversions_impl.h:393
pdfium::internal::SaturateFastAsmOp
Definition
safe_conversions.h:28
pdfium::internal::SaturateFastAsmOp::Do
static constexpr Dst Do(Src)
Definition
safe_conversions.h:30
pdfium::internal::SaturateFastAsmOp::is_supported
static constexpr bool is_supported
Definition
safe_conversions.h:29
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
numerics
safe_conversions_arm_impl.h
Generated on
for Qt by
1.14.0