Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Macros
ws_roundup.h File Reference

Go to the source code of this file.

Macros

#define WS_ROUNDUP_2(n)   (((n) + ((unsigned)(2U-1U))) & (~((unsigned)(2U-1U))))
 Round up to the next multiple of 2.
 
#define WS_ROUNDUP_4(n)   (((n) + ((unsigned)(4U-1U))) & (~((unsigned)(4U-1U))))
 Round up to the next multiple of 4.
 
#define WS_ROUNDUP_8(n)   (((n) + ((unsigned)(8U-1U))) & (~((unsigned)(8U-1U))))
 Round up to the next multiple of 8.
 
#define WS_ROUNDUP_16(n)   (((n) + ((unsigned)(16U-1U))) & (~((unsigned)(16U-1U))))
 Round up to the next multiple of 16.
 
#define WS_ROUNDUP_32(n)   (((n) + ((unsigned)(32U-1U))) & (~((unsigned)(32U-1U))))
 Round up to the next multiple of 32.
 

Detailed Description

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

Macro Definition Documentation

◆ WS_ROUNDUP_16

#define WS_ROUNDUP_16 (   n)    (((n) + ((unsigned)(16U-1U))) & (~((unsigned)(16U-1U))))

Round up to the next multiple of 16.

Parameters
nValue to round up.
Returns
Rounded-up value aligned to 16 bytes.

◆ WS_ROUNDUP_2

#define WS_ROUNDUP_2 (   n)    (((n) + ((unsigned)(2U-1U))) & (~((unsigned)(2U-1U))))

Round up to the next multiple of 2.

Parameters
nValue to round up.
Returns
Rounded-up value aligned to 2 bytes.

◆ WS_ROUNDUP_32

#define WS_ROUNDUP_32 (   n)    (((n) + ((unsigned)(32U-1U))) & (~((unsigned)(32U-1U))))

Round up to the next multiple of 32.

Parameters
nValue to round up.
Returns
Rounded-up value aligned to 32 bytes.

◆ WS_ROUNDUP_4

#define WS_ROUNDUP_4 (   n)    (((n) + ((unsigned)(4U-1U))) & (~((unsigned)(4U-1U))))

Round up to the next multiple of 4.

Parameters
nValue to round up.
Returns
Rounded-up value aligned to 4 bytes.

◆ WS_ROUNDUP_8

#define WS_ROUNDUP_8 (   n)    (((n) + ((unsigned)(8U-1U))) & (~((unsigned)(8U-1U))))

Round up to the next multiple of 8.

Parameters
nValue to round up.
Returns
Rounded-up value aligned to 8 bytes.