Binary op for u32.

This commit is contained in:
laurent
2023-06-23 14:50:52 +01:00
parent 92da45879c
commit 08394f7924
2 changed files with 22 additions and 0 deletions

View File

@ -49,6 +49,7 @@ pub(crate) trait BinaryOp {
const KERNEL_F64: &'static str;
fn f32(v1: f32, v2: f32) -> f32;
fn f64(v1: f64, v2: f64) -> f64;
fn u32(v1: u32, v2: u32) -> u32;
}
pub(crate) struct Add;
@ -70,6 +71,9 @@ impl BinaryOp for Add {
fn f64(v1: f64, v2: f64) -> f64 {
v1 + v2
}
fn u32(v1: u32, v2: u32) -> u32 {
v1 + v2
}
}
impl BinaryOp for Sub {
@ -82,6 +86,9 @@ impl BinaryOp for Sub {
fn f64(v1: f64, v2: f64) -> f64 {
v1 - v2
}
fn u32(v1: u32, v2: u32) -> u32 {
v1 - v2
}
}
impl BinaryOp for Mul {
@ -94,6 +101,9 @@ impl BinaryOp for Mul {
fn f64(v1: f64, v2: f64) -> f64 {
v1 * v2
}
fn u32(v1: u32, v2: u32) -> u32 {
v1 * v2
}
}
impl BinaryOp for Div {
@ -106,6 +116,9 @@ impl BinaryOp for Div {
fn f64(v1: f64, v2: f64) -> f64 {
v1 / v2
}
fn u32(v1: u32, v2: u32) -> u32 {
v1 / v2
}
}
impl UnaryOp for Neg {