4.104.115
Last change
on this file since da42259 was
2a4e8e0,
checked in by Joel Sherrill <joel.sherrill@…>, on 06/13/09 at 22:39:39
|
2009-06-13 Joel Sherrill <joel.sherrill@…>
- rtems/include/rtems/rtems/region.h,
rtems/src/rtemsobjectgetclassinfo.c, score/src/heapwalk.c,
score/src/objectgetnameasstring.c, score/src/objectsetname.c,
score/src/timespecdivide.c, score/src/ts64divide.c: Remove include of
stdio.h
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file score/src/ts64divide.c |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * COPYRIGHT (c) 1989-2007. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #if HAVE_CONFIG_H |
---|
17 | #include "config.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #include <rtems/system.h> |
---|
21 | #include <sys/types.h> |
---|
22 | #include <rtems/score/timestamp.h> |
---|
23 | |
---|
24 | /* This method is never inlined. */ |
---|
25 | #if defined(CPU_RTEMS_SCORE_TIMESTAMP_IS_INT64) |
---|
26 | void _Timestamp64_Divide( |
---|
27 | const Timestamp64_Control *_lhs, |
---|
28 | const Timestamp64_Control *_rhs, |
---|
29 | uint32_t *_ival_percentage, |
---|
30 | uint32_t *_fval_percentage |
---|
31 | ) |
---|
32 | { |
---|
33 | Timestamp64_Control answer; |
---|
34 | |
---|
35 | if ( *_rhs == 0 ) { |
---|
36 | *_ival_percentage = 0; |
---|
37 | *_fval_percentage = 0; |
---|
38 | return; |
---|
39 | } |
---|
40 | |
---|
41 | /* |
---|
42 | * This looks odd but gives the results the proper precision. |
---|
43 | * |
---|
44 | * TODO: Rounding on the last digit of the fval. |
---|
45 | */ |
---|
46 | |
---|
47 | answer = (*_lhs * 100000) / *_rhs; |
---|
48 | |
---|
49 | *_ival_percentage = answer / 1000; |
---|
50 | *_fval_percentage = answer % 1000; |
---|
51 | } |
---|
52 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.