Skip to content

Commit c34d24a

Browse files
committed
Potential optimization for IdToCurve
1 parent fdc81e2 commit c34d24a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Classes/FCryptoEC_Prime.uc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,14 @@ static final function int RunCode(
502502
return R;
503503
}
504504

505-
static final function CurveParams IdToCurve(EFCEllipticCurve Curve)
505+
// Differs from C version: const out param for performance.
506+
// TODO: benchmark the actual difference when this has a return value struct.
507+
static final function IdToCurve(
508+
EFCEllipticCurve Curve,
509+
const out CurveParams out_CurveParams
510+
)
506511
{
507-
return default._PP[Curve - FCEC_Secp256r1];
512+
out_CurveParams = default._PP[Curve - FCEC_Secp256r1];
508513
};
509514

510515
static function array<byte> Generator(EFCEllipticCurve Curve, out int Len)

0 commit comments

Comments
 (0)