GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_utility_64_unsigned_read.c Lines: 6 6 100.0 %
Date: 2024-03-11 05:15:45 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
/** FileX Component                                                       */
16
/**                                                                       */
17
/**   Utility                                                             */
18
/**                                                                       */
19
/**************************************************************************/
20
/**************************************************************************/
21
22
#define FX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "fx_api.h"
28
#include "fx_system.h"
29
#include "fx_utility.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _fx_utility_64_unsigned_read                        PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    William E. Lamie, Microsoft Corporation                             */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function reads (with endian awareness) a 64-bit unsigned data  */
45
/*    from the specified source and returns the value to the caller.      */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    source_ptr                            Source memory pointer         */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    ULONG64 value                                                       */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    None                                                                */
58
/*                                                                        */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    FileX System Functions                                              */
62
/*                                                                        */
63
/*  RELEASE HISTORY                                                       */
64
/*                                                                        */
65
/*    DATE              NAME                      DESCRIPTION             */
66
/*                                                                        */
67
/*  05-19-2020     William E. Lamie         Initial Version 6.0           */
68
/*  09-30-2020     William E. Lamie         Modified comment(s),          */
69
/*                                            resulting in version 6.1    */
70
/*                                                                        */
71
/**************************************************************************/
72
1
ULONG64  _fx_utility_64_unsigned_read(UCHAR *source_ptr)
73
{
74
75
ULONG64 value;
76
ULONG   upper_portion;
77
ULONG   lower_portion;
78
79
80
1
    lower_portion = _fx_utility_32_unsigned_read(source_ptr);
81
1
    upper_portion = _fx_utility_32_unsigned_read(source_ptr + sizeof(ULONG));
82
83
1
    value =  ((ULONG64)upper_portion) << 32;
84
1
    value |= (ULONG64)lower_portion;
85
86
    /* Return 64-bit value to caller.  */
87
1
    return(value);
88
}
89