source: rtems/cpukit/score/src/ts64divide.c @ 5a58b1e

4.115
Last change on this file since 5a58b1e was 5a58b1e, checked in by Daniel Georgiev <daniel.georgiev95@…>, on 12/01/12 at 14:53:45

score misc: Score misc: Clean up Doxygen #11 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/8013204

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Divide Timestamp
5 *  @ingroup SuperCore
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/timestamp.h>
22
23/* This method is never inlined. */
24#if CPU_TIMESTAMP_USE_INT64 == TRUE || CPU_TIMESTAMP_USE_INT64_INLINE == TRUE
25void _Timestamp64_Divide(
26  const Timestamp64_Control *_lhs,
27  const Timestamp64_Control *_rhs,
28  uint32_t                  *_ival_percentage,
29  uint32_t                  *_fval_percentage
30)
31{
32  Timestamp64_Control answer;
33
34  if ( *_rhs == 0 ) {
35    *_ival_percentage = 0;
36    *_fval_percentage = 0;
37    return;
38  }
39
40  /*
41   *  This looks odd but gives the results the proper precision.
42   *
43   *  TODO: Rounding on the last digit of the fval.
44   */
45
46  answer = (*_lhs * 100000) / *_rhs;
47
48  *_ival_percentage = answer / 1000;
49  *_fval_percentage = answer % 1000;
50}
51#endif
Note: See TracBrowser for help on using the repository browser.