Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F132321966
D35937.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
759 B
Referenced Files
None
Subscribers
None
D35937.id.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/math64.h b/sys/compat/linuxkpi/common/include/linux/math64.h
--- a/sys/compat/linuxkpi/common/include/linux/math64.h
+++ b/sys/compat/linuxkpi/common/include/linux/math64.h
@@ -100,4 +100,23 @@
#define DIV64_U64_ROUND_UP(...) \
div64_u64_round_up(__VA_ARGS__)
+static inline uint64_t
+mul_u64_u32_div(uint64_t x, uint32_t y, uint32_t div)
+{
+ const uint64_t rem = x % div;
+
+ return ((x / div) * y + (rem * y) / div);
+}
+
+static inline uint64_t
+mul_u64_u32_shr(uint64_t x, uint32_t y, unsigned int shift)
+{
+ uint32_t hi, lo;
+ hi = x >> 32;
+ lo = x & 0xffffffff;
+
+ return (mul_u32_u32(lo, y) >> shift) +
+ (mul_u32_u32(hi, y) << (32 - shift));
+}
+
#endif /* _LINUXKPI_LINUX_MATH64_H */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 16, 9:30 PM (14 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23759439
Default Alt Text
D35937.id.diff (759 B)
Attached To
Mode
D35937: linuxkpi: math.h: Add mul_u64_u32_div and mul_u64_u32_shr
Attached
Detach File
Event Timeline
Log In to Comment