GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_utility_math_cos.c Lines: 2 2 100.0 %
Date: 2024-12-05 08:52:37 Branches: 0 0 - %

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