mirror of
https://github.com/ipxe/ipxe
synced 2026-10-07 15:05:42 +03:00
[build] Fix technically undefined left shifts in reputable code
Fix the technically undefined constant left shifts into the sign bit in code where there is some value in attempting to minimise the aesthetic disruption from doing so. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -59,8 +59,8 @@ struct imgheader {
|
||||
#define NBI_LENGTH(len) ( NBI_NONVENDOR_LENGTH(len) + NBI_VENDOR_LENGTH(len) )
|
||||
|
||||
/* Interpretation of the "flags" fields */
|
||||
#define NBI_PROGRAM_RETURNS(flags) ( (flags) & ( 1 << 8 ) )
|
||||
#define NBI_LINEAR_EXEC_ADDR(flags) ( (flags) & ( 1 << 31 ) )
|
||||
#define NBI_PROGRAM_RETURNS(flags) ( (flags) & ( 1U << 8 ) )
|
||||
#define NBI_LINEAR_EXEC_ADDR(flags) ( (flags) & ( 1U << 31 ) )
|
||||
|
||||
/** NBI header length */
|
||||
#define NBI_HEADER_LENGTH 512
|
||||
@@ -88,7 +88,7 @@ struct segheader {
|
||||
#define NBI_LOADADDR_AFTER 0x01
|
||||
#define NBI_LOADADDR_END 0x02
|
||||
#define NBI_LOADADDR_BEFORE 0x03
|
||||
#define NBI_LAST_SEGHEADER(flags) ( (flags) & ( 1 << 2 ) )
|
||||
#define NBI_LAST_SEGHEADER(flags) ( (flags) & ( 1U << 2 ) )
|
||||
|
||||
/* Define a type for passing info to a loaded program */
|
||||
struct ebinfo {
|
||||
|
||||
@@ -43,7 +43,8 @@ FILE_SECBOOT ( PERMITTED );
|
||||
* @v rgb 24-bit RGB value (or ANSICOL_NO_RGB)
|
||||
* @ret ansicol ANSI colour definition
|
||||
*/
|
||||
#define ANSICOL_DEFINE( basic, rgb ) ( ( (basic) << 28 ) | (rgb) )
|
||||
#define ANSICOL_DEFINE( basic, rgb ) \
|
||||
( ( ( ( unsigned int ) (basic) ) << 28 ) | (rgb) )
|
||||
|
||||
/**
|
||||
* Extract basic colour from ANSI colour definition
|
||||
|
||||
@@ -59,7 +59,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
*/
|
||||
#define MEMMAP_TAG( start, count, include_start, include_length, \
|
||||
ignore, scale ) \
|
||||
( ( (start) << 16 ) | ( ( (count) - 1 ) << 24 ) | \
|
||||
( ( (start) << 16 ) | ( ( (count) - 1U ) << 24 ) | \
|
||||
( (ignore) << 10 ) | ( (include_length) << 9 ) | \
|
||||
( (include_start) << 8 ) | (scale) )
|
||||
|
||||
|
||||
+12
-6
@@ -216,12 +216,18 @@ struct des_generator {
|
||||
INV3, BIT3, INV2, BIT2, INV1, BIT1, INV0, BIT0 ) \
|
||||
{ \
|
||||
.permutation = (PERMUTATION), \
|
||||
.seed = ( ( (INV0) << 31 ) | ( (BIT0) << 28 ) | \
|
||||
( (INV1) << 27 ) | ( (BIT1) << 24 ) | \
|
||||
( (INV2) << 23 ) | ( (BIT2) << 20 ) | \
|
||||
( (INV3) << 19 ) | ( (BIT3) << 16 ) | \
|
||||
( (INV4) << 15 ) | ( (BIT4) << 12 ) | \
|
||||
( (INV5) << 11 ) | ( (BIT5) << 8 ) | \
|
||||
.seed = ( ( ( ( unsigned int ) (INV0) ) << 31 ) | \
|
||||
( ( ( unsigned int ) (BIT0) ) << 28 ) | \
|
||||
( ( ( unsigned int ) (INV1) ) << 27 ) | \
|
||||
( ( ( unsigned int ) (BIT1) ) << 24 ) | \
|
||||
( ( ( unsigned int ) (INV2) ) << 23 ) | \
|
||||
( ( ( unsigned int ) (BIT2) ) << 20 ) | \
|
||||
( ( ( unsigned int ) (INV3) ) << 19 ) | \
|
||||
( ( ( unsigned int ) (BIT3) ) << 16 ) | \
|
||||
( ( ( unsigned int ) (INV4) ) << 15 ) | \
|
||||
( ( ( unsigned int ) (BIT4) ) << 12 ) | \
|
||||
( ( ( unsigned int ) (INV5) ) << 11 ) | \
|
||||
( ( ( unsigned int ) (BIT5) ) << 8 ) | \
|
||||
( ( uint32_t ) sizeof (PERMUTATION) - 1 ) | \
|
||||
(OFFSET) ), \
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ static int usb_settings_fetch ( struct settings *settings __unused,
|
||||
int rc;
|
||||
|
||||
/* Extract parameters from tag */
|
||||
tag_direction = ( ( setting->tag & ( 1 << 31 ) ) ? +1 : -1 );
|
||||
tag_direction = ( ( setting->tag & ( 1U << 31 ) ) ? +1 : -1 );
|
||||
tag_busdev = ( ( setting->tag >> 16 ) & 0x7fff );
|
||||
tag_offset = ( ( setting->tag >> 8 ) & 0xff );
|
||||
tag_len = ( ( setting->tag >> 0 ) & 0xff );
|
||||
|
||||
@@ -85,7 +85,8 @@ typedef unsigned char pseudo_bit_t;
|
||||
*/
|
||||
|
||||
#define MLX_ASSEMBLE_1( _structure_st, _index, _field, _value ) \
|
||||
( (_value) << MLX_DWORD_BIT_OFFSET ( _structure_st, _index, _field ) )
|
||||
( ( ( unsigned int ) (_value) ) << \
|
||||
MLX_DWORD_BIT_OFFSET ( _structure_st, _index, _field ) )
|
||||
|
||||
#define MLX_ASSEMBLE_2( _structure_st, _index, _field, _value, ... ) \
|
||||
( MLX_ASSEMBLE_1 ( _structure_st, _index, _field, _value ) | \
|
||||
|
||||
@@ -109,7 +109,7 @@ FILE_SECBOOT ( PERMITTED );
|
||||
#define INTELX_MAXFRS_MFS(len) ( (len) << 16 ) /**< Maximum frame size */
|
||||
#define INTELX_MAXFRS_MFS_DEFAULT \
|
||||
INTELX_MAXFRS_MFS ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */ )
|
||||
#define INTELX_MAXFRS_MFS_MASK INTELX_MAXFRS_MFS ( 0xffff )
|
||||
#define INTELX_MAXFRS_MFS_MASK INTELX_MAXFRS_MFS ( 0xffffU )
|
||||
|
||||
/** Link Status Register */
|
||||
#define INTELX_LINKS 0x042a4UL
|
||||
|
||||
@@ -2166,7 +2166,7 @@ static void xhci_configure_endpoint_input ( struct xhci_device *xhci,
|
||||
|
||||
/* Populate slot context */
|
||||
slot_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_SLOT ));
|
||||
slot_ctx->info = cpu_to_le32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1 ),
|
||||
slot_ctx->info = cpu_to_le32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1U ),
|
||||
( slot->ports ? 1 : 0 ),
|
||||
slot->psiv, 0 ) );
|
||||
slot_ctx->ports = slot->ports;
|
||||
@@ -2232,7 +2232,7 @@ xhci_deconfigure_endpoint_input ( struct xhci_device *xhci __unused,
|
||||
|
||||
/* Populate slot context */
|
||||
slot_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_SLOT ));
|
||||
slot_ctx->info = cpu_to_le32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1 ),
|
||||
slot_ctx->info = cpu_to_le32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1U ),
|
||||
0, 0, 0 ) );
|
||||
}
|
||||
|
||||
@@ -2287,7 +2287,7 @@ static void xhci_evaluate_context_input ( struct xhci_device *xhci,
|
||||
|
||||
/* Populate slot context */
|
||||
slot_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_SLOT ));
|
||||
slot_ctx->info = cpu_to_le32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1 ),
|
||||
slot_ctx->info = cpu_to_le32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1U ),
|
||||
0, 0, 0 ) );
|
||||
|
||||
/* Populate endpoint context */
|
||||
|
||||
@@ -144,7 +144,7 @@ extern WINDOW _stdscr;
|
||||
#define A_STANDOUT WA_STANDOUT
|
||||
#define A_UNDERLINE WA_UNDERLINE
|
||||
|
||||
#define A_ATTRIBUTES ( 0xffff << ATTRS_SHIFT )
|
||||
#define A_ATTRIBUTES ( 0xffffU << ATTRS_SHIFT )
|
||||
#define A_CHARTEXT ( 0xff )
|
||||
#define A_COLOUR ( 0xff << CPAIR_SHIFT )
|
||||
#define A_COLOR A_COLOUR
|
||||
|
||||
@@ -37,9 +37,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
/** Xsigo resource types */
|
||||
enum xsigo_resource_type {
|
||||
/** Virtual Ethernet resource type */
|
||||
XSIGO_RESOURCE_XVE = ( 1 << 6 ),
|
||||
XSIGO_RESOURCE_XVE = ( 1U << 6 ),
|
||||
/** Absence-of-high-availability "resource" type */
|
||||
XSIGO_RESOURCE_NO_HA = ( 1 << 4 ),
|
||||
XSIGO_RESOURCE_NO_HA = ( 1U << 4 ),
|
||||
};
|
||||
|
||||
/** A Xsigo server identifier */
|
||||
@@ -216,7 +216,7 @@ enum xsmp_session_type {
|
||||
/** XSMP boot flags */
|
||||
enum xsmp_session_boot {
|
||||
/** PXE boot */
|
||||
XSMP_BOOT_PXE = ( 1 << 0 ),
|
||||
XSMP_BOOT_PXE = ( 1U << 0 ),
|
||||
};
|
||||
|
||||
/** XSMP virtual Ethernet channel adapter parameters */
|
||||
@@ -338,13 +338,13 @@ enum xsmp_xve_code {
|
||||
/** XSMP virtual Ethernet update bitmask */
|
||||
enum xsmp_xve_update {
|
||||
/** Update MTU */
|
||||
XSMP_XVE_UPDATE_MTU = ( 1 << 2 ),
|
||||
XSMP_XVE_UPDATE_MTU = ( 1U << 2 ),
|
||||
/** Update administrative state */
|
||||
XSMP_XVE_UPDATE_STATE = ( 1 << 6 ),
|
||||
XSMP_XVE_UPDATE_STATE = ( 1U << 6 ),
|
||||
/** Update gateway to mark as down */
|
||||
XSMP_XVE_UPDATE_GW_DOWN = ( 1 << 30 ),
|
||||
XSMP_XVE_UPDATE_GW_DOWN = ( 1U << 30 ),
|
||||
/** Update gateway information */
|
||||
XSMP_XVE_UPDATE_GW_CHANGE = ( 1 << 31 ),
|
||||
XSMP_XVE_UPDATE_GW_CHANGE = ( 1U << 31 ),
|
||||
};
|
||||
|
||||
/** XSMP virtual Ethernet modes */
|
||||
|
||||
Reference in New Issue
Block a user