Skip to content

HI_NIBBLE macro

Douglas Lyman edited this page Nov 28, 2022 · 2 revisions

Gets the upper 4 bits of a byte.

Syntax

#define HI_NIBBLE(b) (((b) >> 4) & 0x0F)
BYTE HI_NIBBLE(BYTE b);

Parameters

b
The byte to get bits from.

Returns

The upper 4 bits of the input byte.

Examples

#include "Definitions.h"

int main() {
    BYTE b = HI_NIBBLE(0xAB); // Returns: 0xA.
}

Requirements

Header Definitions.h
Assembly None