GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_utility_math_cos.c Lines: 2 2 100.0 %
Date: 2026-03-06 19:21:09 Branches: 0 0 - %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   Utility (Utility)                                                   */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_utility.h"
29
30
/**************************************************************************/
31
/*                                                                        */
32
/*  FUNCTION                                               RELEASE        */
33
/*                                                                        */
34
/*    _gx_utility_math_cos_5_4_0                          PORTABLE C      */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    This service computes the cosine of the supplied angle, which is an */
43
/*    old version of _gx_utility_math_cos.                                */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    angle                                 Angle to compute cosine of,   */
48
/*                                          the input angle should be     */
49
/*                                          scaled by 256.                */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    cosine                                Cosine of supplied angle      */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_utility_math_sin_5_4_0                                          */
58
/*                                                                        */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    Application Code                                                    */
62
/*                                                                        */
63
/**************************************************************************/
64
#if defined(GUIX_5_4_0_COMPATIBILITY)
65
INT _gx_utility_math_cos_5_4_0(INT angle)
66
{
67
68
    return _gx_utility_math_sin_5_4_0(angle + 23040);
69
}
70
#endif
71
72
/**************************************************************************/
73
/*                                                                        */
74
/*  FUNCTION                                               RELEASE        */
75
/*                                                                        */
76
/*    _gx_utility_math_cos                                PORTABLE C      */
77
/*                                                           6.1          */
78
/*  AUTHOR                                                                */
79
/*                                                                        */
80
/*    Kenneth Maxwell, Microsoft Corporation                              */
81
/*                                                                        */
82
/*  DESCRIPTION                                                           */
83
/*                                                                        */
84
/*    This service computes the cosine of the supplied angle.             */
85
/*                                                                        */
86
/*  INPUT                                                                 */
87
/*                                                                        */
88
/*    angle                                 Angle to compute cosine of.   */
89
/*                                          The input angle is a fixed    */
90
/*                                          point data type, call         */
91
/*                                          GX_FIXED_VAL_MAKE to covnert  */
92
/*                                          from INT to fixed point data. */
93
/*                                          type.                         */
94
/*                                                                        */
95
/*  OUTPUT                                                                */
96
/*                                                                        */
97
/*    cosine                                Cosine of supplied angle.     */
98
/*                                          The return consin is a fixed  */
99
/*                                          point math data type, call    */
100
/*                                          GX_FIXED_VAL_TO_INT to convert*/
101
/*                                          from fixed point data type to */
102
/*                                          int.                          */
103
/*                                                                        */
104
/*  CALLS                                                                 */
105
/*                                                                        */
106
/*    _gx_utility_math_sin                                                */
107
/*                                                                        */
108
/*  CALLED BY                                                             */
109
/*                                                                        */
110
/*    Application Code                                                    */
111
/*                                                                        */
112
/**************************************************************************/
113
129691
GX_FIXED_VAL _gx_utility_math_cos(GX_FIXED_VAL angle)
114
{
115
116
129691
    return _gx_utility_math_sin(angle + GX_FIXED_VAL_MAKE(90));
117
}
118