rol.hHeader

This file provides a mechanism for selecting between enhanced and default implementations of the Rotate Left (ROL) operation. More...

Detailed Description

The rol.h file is designed to include the appropriate header file for the Rotate Left (ROL) operation, based on the configuration specified at compile time. The ROL operation is a common bitwise operation used in various cryptographic algorithms, encoding schemes, and performance optimizations.

Key Features:

  • Conditional Inclusion : The file conditionally includes either the enhanced or default implementation of the ROL operation based on the ANTISPY_USE_ENHANCED_ROL macro.

  • Flexibility : Allows for easy switching between different implementations of the ROL operation, which can be useful for optimizing performance or security based on the application's needs.

Configuration:

The selection between the enhanced and default ROL implementation is controlled by the ANTISPY_USE_ENHANCED_ROL macro.

  • If ANTISPY_USE_ENHANCED_ROL is defined, the enhanced implementation located in enhanced/enhanced_rol.h is included.

  • If ANTISPY_USE_ENHANCED_ROL is not defined, the default implementation located in default/default_rol.h is included.

This design allows developers to easily configure their build to use a specific version of the ROL operation, depending on their performance or security requirements.

Usage Example:

// Depending on the value of the ANTISPY_USE_ENHANCED_ROL macro, the appropriate ROL implementation is included.
#include <anitspy/libantispy.h>

int main() {
    // Use the ROL operation provided by the included header.
    uint32_t value = 0x12345678;
    uint32_t rotated_value = ::libantispy::rol(value, 5); // Rotate left by 5 bits.
    return 0;
}

In this example, the rol.h file ensures that the correct ROL implementation is included, and the rol function can then be used to perform a rotate-left operation on a 32-bit integer.