imagingmodules/jp2kcodec/Src/JP2KUtils.cpp
changeset 10 ac33adcbae0f
parent 0 469c91dae73b
equal deleted inserted replaced
0:469c91dae73b 10:ac33adcbae0f
    45 // CONSTANTS
    45 // CONSTANTS
    46 
    46 
    47 // ============================ MEMBER FUNCTIONS ===============================
    47 // ============================ MEMBER FUNCTIONS ===============================
    48 
    48 
    49 // -----------------------------------------------------------------------------
    49 // -----------------------------------------------------------------------------
    50 // TJ2kUtils::Ceil
    50 // TJ2kUtils::CeilL
    51 // Get the ceiling between two integers.
    51 // Get the ceiling between two integers.
    52 // (other items were commented in a header).
    52 // (other items were commented in a header).
    53 // -----------------------------------------------------------------------------
    53 // -----------------------------------------------------------------------------
    54 //
    54 //
    55 TInt32 TJ2kUtils::Ceil( TInt32 aL, TInt32 aR )
    55 TInt32 TJ2kUtils::CeilL( TInt32 aL, TInt32 aR )
    56     {
    56     {
    57     // Check that no divided by zero calculation are done.
    57     // Check that no divided by zero calculation are done.
    58     if ( aR == 0 )
    58     if ( aR == 0 )
    59     	{
    59     	{
    60     	User::Leave( KErrCorrupt );
    60     	User::Leave( KErrCorrupt );
    82         return ( aL % aR ) ? ( aL / aR ) + 1 : aL / aR;
    82         return ( aL % aR ) ? ( aL / aR ) + 1 : aL / aR;
    83         }
    83         }
    84     }
    84     }
    85 
    85 
    86 // -----------------------------------------------------------------------------
    86 // -----------------------------------------------------------------------------
    87 // TJ2kUtils::Floor
    87 // TJ2kUtils::FloorL
    88 // Get the floor between two integers.
    88 // Get the floor between two integers.
    89 // (other items were commented in a header).
    89 // (other items were commented in a header).
    90 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
    91 //
    91 //
    92 TInt32 TJ2kUtils::Floor( TInt32 aL, TInt32 aR )
    92 TInt32 TJ2kUtils::FloorL( TInt32 aL, TInt32 aR )
    93     {
    93     {
    94     // Check that no divided by zero calculation are done.
    94     // Check that no divided by zero calculation are done.
    95     if ( aR == 0 )
    95     if ( aR == 0 )
    96     	{
    96     	{
    97     	User::Leave( KErrCorrupt );
    97     	User::Leave( KErrCorrupt );
   106         return aL / aR;
   106         return aL / aR;
   107         }
   107         }
   108     }
   108     }
   109 
   109 
   110 // -----------------------------------------------------------------------------
   110 // -----------------------------------------------------------------------------
   111 // TJ2kUtils::Div
   111 // TJ2kUtils::DivL
   112 // Get the quotient and remainder.
   112 // Get the quotient and remainder.
   113 // (other items were commented in a header).
   113 // (other items were commented in a header).
   114 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
   115 //
   115 //
   116 TDiv TJ2kUtils::Div( TInt aNum, TInt aDenom )
   116 TDiv TJ2kUtils::DivL( TInt aNum, TInt aDenom )
   117     {
   117     {
   118     // Check that no divided by zero calculation are done.
   118     // Check that no divided by zero calculation are done.
   119     if ( aDenom == 0 )
   119     if ( aDenom == 0 )
   120     	{
   120     	{
   121     	User::Leave( KErrCorrupt );
   121     	User::Leave( KErrCorrupt );