Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Macros | Functions
type_util.h File Reference
#include <inttypes.h>
#include "ws_symbol_export.h"

Go to the source code of this file.

Macros

#define double_to_uint64(value)   ((uint64_t)(value))
 
#define uint64_to_double(value)   ((double)(value))
 

Functions

WS_DLL_PUBLIC uint64_t type_util_double_to_uint64 (double value)
 Converts a double-precision floating-point value to a 64-bit unsigned integer.
 
WS_DLL_PUBLIC double type_util_uint64_to_double (uint64_t value)
 Converts a 64-bit unsigned integer to a double-precision floating-point value.
 

Detailed Description

Types utility definitions

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Function Documentation

◆ type_util_double_to_uint64()

WS_DLL_PUBLIC uint64_t type_util_double_to_uint64 ( double  value)

Converts a double-precision floating-point value to a 64-bit unsigned integer.

Safely casts a double to a uint64_t, truncating any fractional part.

Parameters
valueThe double value to convert.
Returns
The corresponding uint64_t value.

◆ type_util_uint64_to_double()

WS_DLL_PUBLIC double type_util_uint64_to_double ( uint64_t  value)

Converts a 64-bit unsigned integer to a double-precision floating-point value.

Casts a uint64_t to a double, preserving the full integer value.

Parameters
valueThe uint64_t value to convert.
Returns
The corresponding double value.