mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-13 03:29:49 +00:00
LibJS: Convert to_double() to ThrowCompletionOr
This commit is contained in:
parent
51c33b3b35
commit
1639ed7e0a
Notes:
sideshowbarker
2024-07-18 02:17:22 +09:00
Author: https://github.com/IdanHo
Commit: 1639ed7e0a
Pull-request: https://github.com/SerenityOS/serenity/pull/10504
Reviewed-by: https://github.com/linusg
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