Skip to content

Commit

Permalink
core/math/fixed: implement BrFixedMac{2,3,4}()
Browse files Browse the repository at this point in the history
  • Loading branch information
vs49688 committed May 18, 2024
1 parent b93f531 commit 8570937
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/math/fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ br_fixed_ls BR_PUBLIC_ENTRY BrFixedMul(br_fixed_ls a, br_fixed_ls b)
return (br_fixed_ls)(tmp >> 16);
}

br_fixed_ls BR_PUBLIC_ENTRY BrFixedMac2(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d)
{
return (br_fixed_ls)(((a * (br_int_64)b) + (c * (br_int_64)d)) >> 16);
}

br_fixed_ls BR_PUBLIC_ENTRY BrFixedMac3(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d, br_fixed_ls e, br_fixed_ls f)
{
return (br_fixed_ls)(((a * (br_int_64)b) + (c * (br_int_64)d) + (e * (br_int_64)f)) >> 16);
}

br_fixed_ls BR_PUBLIC_ENTRY BrFixedMac4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d, br_fixed_ls e,
br_fixed_ls f, br_fixed_ls g, br_fixed_ls h)
{
return (br_fixed_ls)(((a * (br_int_64)b) + (c * (br_int_64)d) + (e * (br_int_64)f) + (g * (br_int_64)h)) >> 16);
}

br_fixed_ls BR_PUBLIC_ENTRY BrFixedSqr(br_fixed_ls a)
{
return BrFixedMul(a, a);
Expand Down

0 comments on commit 8570937

Please sign in to comment.