| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: jiffies.h,v 1.11 2018/08/27 07:05:13 riastradh Exp $ */ | | 1 | /* $NetBSD: jiffies.h,v 1.12 2018/08/27 13:57:50 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Taylor R. Campbell. | | 8 | * by Taylor R. Campbell. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -49,26 +49,34 @@ get_jiffies_64(void) | | | @@ -49,26 +49,34 @@ get_jiffies_64(void) |
49 | } | | 49 | } |
50 | | | 50 | |
51 | static inline uint64_t | | 51 | static inline uint64_t |
52 | nsecs_to_jiffies64(uint64_t nsec) | | 52 | nsecs_to_jiffies64(uint64_t nsec) |
53 | { | | 53 | { |
54 | | | 54 | |
55 | /* XXX Arbitrary cutoff, should review the arithmetic. */ | | 55 | /* XXX Arbitrary cutoff, should review the arithmetic. */ |
56 | if (((1000000000 % hz) == 0) || (nsec >= 20000000000ul)) | | 56 | if (((1000000000 % hz) == 0) || (nsec >= 20000000000ul)) |
57 | return (nsec/1000000000)*hz; | | 57 | return (nsec/1000000000)*hz; |
58 | else | | 58 | else |
59 | return (nsec*hz)/1000000000; | | 59 | return (nsec*hz)/1000000000; |
60 | } | | 60 | } |
61 | | | 61 | |
| | | 62 | static inline uint32_t |
| | | 63 | nsecs_to_jiffies(uint64_t nsec) |
| | | 64 | { |
| | | 65 | |
| | | 66 | /* XXX Not sure what else to do but truncate... */ |
| | | 67 | return (uint32_t)nsecs_to_jiffies64(nsec); |
| | | 68 | } |
| | | 69 | |
62 | static inline unsigned int | | 70 | static inline unsigned int |
63 | msecs_to_jiffies(unsigned int msec) | | 71 | msecs_to_jiffies(unsigned int msec) |
64 | { | | 72 | { |
65 | return mstohz(msec); | | 73 | return mstohz(msec); |
66 | } | | 74 | } |
67 | | | 75 | |
68 | static inline unsigned int | | 76 | static inline unsigned int |
69 | jiffies_to_msecs(unsigned int j) | | 77 | jiffies_to_msecs(unsigned int j) |
70 | { | | 78 | { |
71 | return hztoms(j); | | 79 | return hztoms(j); |
72 | } | | 80 | } |
73 | | | 81 | |
74 | static inline unsigned int | | 82 | static inline unsigned int |