mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8188813: Generalize OrderAccess to use templates
Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
21ee7f4b2a
commit
bf5816a2c5
21 changed files with 376 additions and 433 deletions
|
@ -167,4 +167,24 @@ inline T PrimitiveConversions::cast(U x) {
|
|||
return Cast<T, U>()(x);
|
||||
}
|
||||
|
||||
// jfloat and jdouble translation to integral types
|
||||
|
||||
template<>
|
||||
struct PrimitiveConversions::Translate<jdouble> : public TrueType {
|
||||
typedef double Value;
|
||||
typedef int64_t Decayed;
|
||||
|
||||
static Decayed decay(Value x) { return PrimitiveConversions::cast<Decayed>(x); }
|
||||
static Value recover(Decayed x) { return PrimitiveConversions::cast<Value>(x); }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct PrimitiveConversions::Translate<jfloat> : public TrueType {
|
||||
typedef float Value;
|
||||
typedef int32_t Decayed;
|
||||
|
||||
static Decayed decay(Value x) { return PrimitiveConversions::cast<Decayed>(x); }
|
||||
static Value recover(Decayed x) { return PrimitiveConversions::cast<Value>(x); }
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_METAPROGRAMMING_PRIMITIVECONVERSIONS_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue