mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-06 13:35:03 +00:00
LibJS: Implement multiplication and division operators
This commit is contained in:
committed by
Andreas Kling
parent
9f3f0d9983
commit
fdf7f81ba9
@@ -145,7 +145,6 @@ Value right_shift(Value lhs, Value rhs)
|
||||
}
|
||||
|
||||
Value add(Value lhs, Value rhs)
|
||||
|
||||
{
|
||||
ASSERT(lhs.is_number());
|
||||
ASSERT(rhs.is_number());
|
||||
@@ -159,6 +158,20 @@ Value sub(Value lhs, Value rhs)
|
||||
return Value(lhs.as_double() - rhs.as_double());
|
||||
}
|
||||
|
||||
Value mul(Value lhs, Value rhs)
|
||||
{
|
||||
ASSERT(lhs.is_number());
|
||||
ASSERT(rhs.is_number());
|
||||
return Value(lhs.as_double() * rhs.as_double());
|
||||
}
|
||||
|
||||
Value div(Value lhs, Value rhs)
|
||||
{
|
||||
ASSERT(lhs.is_number());
|
||||
ASSERT(rhs.is_number());
|
||||
return Value(lhs.as_double() / rhs.as_double());
|
||||
}
|
||||
|
||||
Value typed_eq(Value lhs, Value rhs)
|
||||
{
|
||||
if (rhs.type() != lhs.type())
|
||||
|
||||
Reference in New Issue
Block a user