Rev 5078 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5078 | Rev 6296 | ||
---|---|---|---|
Line 151... | Line 151... | ||
151 | 151 | ||
152 | (void) vmw_marker_pull(queue, seqno); |
152 | (void) vmw_marker_pull(queue, seqno); |
153 | } |
153 | } |
154 | return 0; |
154 | return 0; |
155 | } |
- | |
156 | - | ||
157 | s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) |
- | |
158 | { |
- | |
159 | u64 quotient; |
- | |
160 | - | ||
161 | if (dividend < 0) { |
- | |
162 | quotient = div_u64_rem(-dividend, abs(divisor), (u32 *)remainder); |
- | |
163 | *remainder = -*remainder; |
- | |
164 | if (divisor > 0) |
- | |
165 | quotient = -quotient; |
- | |
166 | } else { |
- | |
167 | quotient = div_u64_rem(dividend, abs(divisor), (u32 *)remainder); |
- | |
168 | if (divisor < 0) |
- | |
169 | quotient = -quotient; |
- | |
170 | } |
- | |
171 | return quotient; |
- | |
172 | } |
- | |
173 | - | ||
174 | struct timespec ns_to_timespec(const s64 nsec) |
- | |
175 | { |
- | |
176 | struct timespec ts; |
- | |
177 | s32 rem; |
- | |
178 | - | ||
179 | if (!nsec) |
- | |
180 | return (struct timespec) {0, 0}; |
- | |
181 | - | ||
182 | ts.tv_sec = div_s64_rem(nsec, NSEC_PER_SEC, &rem); |
- | |
183 | if (unlikely(rem < 0)) { |
- | |
184 | ts.tv_sec--; |
- | |
185 | rem += NSEC_PER_SEC; |
- | |
186 | } |
- | |
187 | ts.tv_nsec = rem; |
- | |
188 | - | ||
189 | return ts; |
- | |
190 | }>>>=>><> |
- |