GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_utility_16_unsigned_read.c Lines: 4 4 100.0 %
Date: 2026-03-06 18:49:02 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
/** FileX Component                                                       */
17
/**                                                                       */
18
/**   Utility                                                             */
19
/**                                                                       */
20
/**************************************************************************/
21
/**************************************************************************/
22
23
#define FX_SOURCE_CODE
24
25
26
/* Include necessary system files.  */
27
28
#include "fx_api.h"
29
#include "fx_system.h"
30
#include "fx_utility.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _fx_utility_16_unsigned_read                        PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    William E. Lamie, Microsoft Corporation                             */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function reads (with endian awareness) 16-bit unsigned data    */
46
/*    from the specified source and returns the value to the caller.      */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    source_ptr                            Source memory pointer         */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    UINT value                                                          */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    None                                                                */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    FileX System Functions                                              */
63
/*                                                                        */
64
/**************************************************************************/
65
16405105
UINT  _fx_utility_16_unsigned_read(UCHAR *source_ptr)
66
{
67
68
UINT value;
69
70
    /* Pickup the UINT from the destination with endian-awareness.  */
71
16405105
    value =  ((((UINT)*(source_ptr + 1)) & 0xFF) << 8) |
72
16405105
              ((UINT)*(source_ptr) & 0xFF);
73
74
    /* Return value to caller.  */
75
16405105
    return(value);
76
}
77