mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibJS: Convert to_double() to ThrowCompletionOr
This commit is contained in:
parent
51c33b3b35
commit
1639ed7e0a
10 changed files with 23 additions and 40 deletions
|
@ -141,13 +141,13 @@ static ByteBuffer numeric_to_raw_bytes(GlobalObject& global_object, Value value,
|
|||
swap(raw_bytes[i], raw_bytes[sizeof(UnderlyingBufferDataType) - 1 - i]);
|
||||
};
|
||||
if constexpr (IsSame<UnderlyingBufferDataType, float>) {
|
||||
float raw_value = value.to_double(global_object);
|
||||
float raw_value = MUST(value.to_double(global_object));
|
||||
ReadonlyBytes { &raw_value, sizeof(float) }.copy_to(raw_bytes);
|
||||
flip_if_needed();
|
||||
return raw_bytes;
|
||||
}
|
||||
if constexpr (IsSame<UnderlyingBufferDataType, double>) {
|
||||
double raw_value = value.to_double(global_object);
|
||||
double raw_value = MUST(value.to_double(global_object));
|
||||
ReadonlyBytes { &raw_value, sizeof(double) }.copy_to(raw_bytes);
|
||||
flip_if_needed();
|
||||
return raw_bytes;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue