Commit graph

4 commits

Author SHA1 Message Date
John Baldwin 9ac841e922 divmoddi*: Use separate statements instead of the comma operator.
Differential Revision:	https://reviews.freebsd.org/D40835
2023-07-07 13:01:19 -07:00
John Baldwin 84deca4d8c libkern: Trim OBE comment from divmoddi routines.
-1/2 is defined to be 0 in modern C.

Reviewed by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D40833
2023-07-01 14:43:53 -07:00
John Baldwin df11fb9bf0 divmoddi4: Handle negative remainders.
The sign of the remainder matches the sign of the numerator in C.

Reported by:	jrtc27
Reviewed by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D40832
2023-07-01 14:43:41 -07:00
John Baldwin cc4f247fb9 sys: Add [u]divmoddi4 intrinsics on i386.
GCC 12 uses these in several places when building the i386 kernel.
They are very similar to [u]divdiv3 except that they return both
the quotient and the remainder.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D40817
2023-07-01 12:22:44 -07:00