kernel/acpica/components/executer/exmisc.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiExDoMathOp
 *
 * PARAMETERS:  Opcode              - AML opcode
 *              Integer0            - Integer operand #0
 *              Integer1            - Integer operand #1
 *
 * RETURN:      Integer result of the operation
 *
 * DESCRIPTION: Execute a math AML opcode. The purpose of having all of the
 *              math functions here is to prevent a lot of pointer dereferencing
 *              to obtain the operands.
 *
 ******************************************************************************/
AcpiExDoMathOp
PARAMETERS:  Opcode              - AML opcode
Integer0            - Integer operand #0
Integer1            - Integer operand #1

Integer result of the operation

Execute a math AML opcode. The purpose of having all of the
math functions here is to prevent a lot of pointer dereferencing
to obtain the operands.
AcpiExDoMathOp PARAMETERS : Opcode - AML opcode Integer0 - Integer operand #0 Integer1 - Integer operand #1 Integer result of the operation Execute a math AML opcode . The purpose of having all of the math functions here is to prevent a lot of pointer dereferencing to obtain the operands .
UINT64
AcpiExDoMathOp (
    UINT16                  Opcode,
    UINT64                  Integer0,
    UINT64                  Integer1)
{
    ACPI_FUNCTION_ENTRY ();
    switch (Opcode)
    {
    case AML_ADD_OP:                
        return (Integer0 + Integer1);
    case AML_BIT_AND_OP:            
        return (Integer0 & Integer1);
    case AML_BIT_NAND_OP:           
        return (~(Integer0 & Integer1));
    case AML_BIT_OR_OP:             
        return (Integer0 | Integer1);
    case AML_BIT_NOR_OP:            
        return (~(Integer0 | Integer1));
    case AML_BIT_XOR_OP:            
        return (Integer0 ^ Integer1);
    case AML_MULTIPLY_OP:           
        return (Integer0 * Integer1);
    case AML_SHIFT_LEFT_OP:         
        if (Integer1 >= AcpiGbl_IntegerBitWidth)
        {
            return (0);
        }
        return (Integer0 << Integer1);
    case AML_SHIFT_RIGHT_OP:        
        if (Integer1 >= AcpiGbl_IntegerBitWidth)
        {
            return (0);
        }
        return (Integer0 >> Integer1);
    case AML_SUBTRACT_OP:           
        return (Integer0 - Integer1);
    default:
        return (0);
    }
}
UINT64 AcpiExDoMathOp ( UINT16 Opcode , UINT64 Integer0 , UINT64 Integer1 ) { ACPI_FUNCTION_ENTRY ( ) ; switch ( Opcode ) { case AML_ADD_OP : return ( Integer0 + Integer1 ) ; case AML_BIT_AND_OP : return ( Integer0 & Integer1 ) ; case AML_BIT_NAND_OP : return ( ~ ( Integer0 & Integer1 ) ) ; case AML_BIT_OR_OP : return ( Integer0 | Integer1 ) ; case AML_BIT_NOR_OP : return ( ~ ( Integer0 | Integer1 ) ) ; case AML_BIT_XOR_OP : return ( Integer0 ^ Integer1 ) ; case AML_MULTIPLY_OP : return ( Integer0 * Integer1 ) ; case AML_SHIFT_LEFT_OP : if ( Integer1 >= AcpiGbl_IntegerBitWidth ) { return ( 0 ) ; } return ( Integer0 << Integer1 ) ; case AML_SHIFT_RIGHT_OP : if ( Integer1 >= AcpiGbl_IntegerBitWidth ) { return ( 0 ) ; } return ( Integer0 >> Integer1 ) ; case AML_SUBTRACT_OP : return ( Integer0 - Integer1 ) ; default : return ( 0 ) ; } }
FUNCTION:    AcpiExDoMathOp
 PARAMETERS:  Opcode              - AML opcode
              Integer0            - Integer operand #0
              Integer1            - Integer operand #1
FUNCTION : AcpiExDoMathOp PARAMETERS : Opcode - AML opcode Integer0 - Integer operand #0 Integer1 - Integer operand #1
/* Add (Integer0, Integer1, Result) */ /* And (Integer0, Integer1, Result) */ /* NAnd (Integer0, Integer1, Result) */ /* Or (Integer0, Integer1, Result) */ /* NOr (Integer0, Integer1, Result) */ /* XOr (Integer0, Integer1, Result) */ /* Multiply (Integer0, Integer1, Result) */ /* ShiftLeft (Operand, ShiftCount, Result)*/ /*
         * We need to check if the shiftcount is larger than the integer bit
         * width since the behavior of this is not well-defined in the C language.
         */ /* ShiftRight (Operand, ShiftCount, Result) */ /*
         * We need to check if the shiftcount is larger than the integer bit
         * width since the behavior of this is not well-defined in the C language.
         */ /* Subtract (Integer0, Integer1, Result) */