ror.hHeader

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

Detailed Description

The ror.h file is designed to include the appropriate header file for the Rotate Right (ROR) operation, based on the configuration specified at compile time. The ROR operation is a bitwise operation frequently used in cryptographic algorithms, data encoding schemes, and certain performance optimizations.

Key Features:

  • Conditional Inclusion : This file conditionally includes either the enhanced or default implementation of the ROR operation, depending on the ANTISPY_USE_ENHANCED_ROR macro.

  • Customizable Implementation : It allows developers to easily switch between different ROR implementations to either optimize for performance, security, or compatibility, based on the application's requirements.

Configuration:

The selection between the enhanced and default ROR implementation is controlled by the ANTISPY_USE_ENHANCED_ROR macro.

  • If ANTISPY_USE_ENHANCED_ROR is defined, the enhanced implementation located in enhanced/enhanced_ror.h is included.

  • If ANTISPY_USE_ENHANCED_ROR is not defined, the default implementation located in default/default_ror.h is included.

This mechanism ensures that the most suitable implementation is used depending on the environment and project-specific needs.

Usage Example:

// Depending on the value of the ANTISPY_USE_ENHANCED_ROR macro, the appropriate ROR implementation is included.
#include <antispy/libantispy.h>

int main() {
    // Use the ROR operation provided by the included header.
    uint32_t value = 0x12345678;
    uint32_t rotated_value = ::libantispy::ror(value, 3); // Rotate right by 3 bits.
    return 0;
}

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