| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-additional-options "-ftracer" } */ |
| 3 |
|
| 4 |
extern void abort (void); |
| 5 |
|
| 6 |
typedef long int _PyTime_t; |
| 7 |
typedef enum { _PyTime_ROUND_FLOOR = 0, _PyTime_ROUND_CEILING = 1 } |
| 8 |
_PyTime_round_t; |
| 9 |
|
| 10 |
static _PyTime_t |
| 11 |
_PyTime_Divide(const _PyTime_t t, const _PyTime_t k, |
| 12 |
const _PyTime_round_t round) |
| 13 |
{ |
| 14 |
if (round == _PyTime_ROUND_CEILING) { |
| 15 |
if (t >= 0) |
| 16 |
return (t + k - 1) / k; |
| 17 |
else |
| 18 |
return t / k; |
| 19 |
} |
| 20 |
else { |
| 21 |
if (t >= 0) |
| 22 |
return t / k; |
| 23 |
else |
| 24 |
return (t - (k - 1)) / k; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
_PyTime_t __attribute__((noinline,noclone)) |
| 29 |
_PyTime_AsMicroseconds(_PyTime_t t, _PyTime_round_t round) |
| 30 |
{ |
| 31 |
return _PyTime_Divide(t, 1000, round); |
| 32 |
} |
| 33 |
|
| 34 |
int main() |
| 35 |
{ |
| 36 |
if (_PyTime_AsMicroseconds (10000, _PyTime_ROUND_FLOOR) != 10) |
| 37 |
abort (); |
| 38 |
return 0; |
| 39 |
} |