|
| From: | Richard Henderson |
| Subject: | Re: [PATCH 6/9] bsd-user: common routine do_freebsd_sysctl_oid for all sysctl variants |
| Date: | Sat, 11 Feb 2023 15:13:10 -1000 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 |
On 2/11/23 14:40, Warner Losh wrote:
I was going to do something like:
+ if (host_page_size != TARGET_PAGE_SIZE) {
+ if (host_page_size > TARGET_PAGE_SIZE) {
+ /* Scale up */
+ pages *= host_page_size / TARGET_PAGE_SIZE;
+ } else {
+ /* Scale down with truncation */
+ pages /= TARGET_PAGE_SIZE / host_page_size;
+ }
+ }
in a helper function. Does multdiv64 replace that?
Yes, it uses a 128-bit intermediate result, so no overflow. Obviously the above works as well, but perhaps premature optimization. r~
| [Prev in Thread] | Current Thread | [Next in Thread] |