Commit 267ec305 authored by Nicolas Roussin's avatar Nicolas Roussin
Browse files

Implement W_negate function.

parent c686cdd1
Loading
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -128,6 +128,49 @@ Word64 W_sub_nosat( Word64 L64_var1, Word64 L64_var2 )
}


/*__________________________________________________________________________________
 |                                                                                 |
 |   Function Name : W_negate                                                      |
 |                                                                                 |
 |   Purpose :                                                                     |
 |                                                                                 |
 |   Negate the 64 bit variable L64_var1 with saturation; saturate in the case     |
 |   where input is 0x8000 0000 0000 0000.                                         |
 |                                                                                 |
 |   Complexity weight : 1                                                         |
 |                                                                                 |
 |   Inputs :                                                                      |
 |                                                                                 |
 |    L64_var1 64 bit long signed integer (Word64) whose value falls in the range: |
 |             0x8000 0000 0000 0000 <= L64_var1 <= 0x7fff ffff ffff ffff.         |
 |                                                                                 |
 |   Outputs :                                                                     |
 |                                                                                 |
 |    none                                                                         |
 |                                                                                 |
 |   Return Value :                                                                |
 |                                                                                 |
 |    L64_var_out                                                                  |
 |             64 bit long signed integer (Word64) whose value falls in the range: |
 |             0x8000 0000 0000 0000 <= L_var_out <= 0x7fff ffff ffff ffff.        |
 |_________________________________________________________________________________|
*/
Word64 W_negate( Word64 L64_var1 )
{
    Word64 L64_var_out;

    L64_var_out = ( L64_var1 == MIN_64 ) ? MAX_64 : -L64_var1;

#ifdef WMOPS
    multiCounter[currCounter].W_negate++;
#endif

    BASOP_CHECK();

    return ( L64_var_out );
}


/*___________________________________________________________________________
|                                                                           |
|   Function Name : W_shl                                                   |
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#ifdef ENH_64_BIT_OPERATOR
Word64 W_add_nosat( Word64 L64_var1, Word64 L64_var2 );
Word64 W_sub_nosat( Word64 L64_var1, Word64 L64_var2 );
Word64 W_negate( Word64 L64_var1 );
Word64 W_shl( Word64 L64_var1, Word16 var2 );
Word64 W_shr( Word64 L64_var1, Word16 var2 );
Word64 W_shl_nosat( Word64 L64_var1, Word16 var2 );
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ static BASIC_OP op_weight = {
#ifdef ENH_64_BIT_OPERATOR
    /* Weights of new 64 bit basops */
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_64_BIT_OPERATOR */

#ifdef ENH_32_BIT_OPERATOR
+1 −0
Original line number Diff line number Diff line
@@ -879,6 +879,7 @@ typedef struct
    unsigned int move64;        /* Complexity Weight of 1 */
    unsigned int W_add_nosat;   /* Complexity Weight of 1 */
    unsigned int W_sub_nosat;   /* Complexity Weight of 1 */
    unsigned int W_negate;      /* Complexity Weight of 1 */
    unsigned int W_shl;         /* Complexity Weight of 1 */
    unsigned int W_shr;         /* Complexity Weight of 1 */
    unsigned int W_shl_nosat;   /* Complexity Weight of 1 */