qos_l_other.h File Reference

Composite operations on signed long integers for non-i386 architectures. More...

#include <linux/types.h>

Go to the source code of this file.

Defines

#define l_shl_div(num, SHF, den)   ((__s32) ((((__s64) ((__s32)(num))) << (SHF)) / ((__s32)(den))))
 Computes '(num << SHF) / den' as __s32.
#define l_mul_div(x, num, den)   ((__s32) (((__s64) ((__s32)(x))) * ((__s32)(num)) / ((__s32)(den))))
 Computes '(x * num) / den' as __s32 (32 bits).
#define l_mul_shr(x, y, SHF)   ((__s32) ((((__s64) ((__s32)(x))) * ((__s32)(y))) >> (SHF)))
 Computes '(x * y) >> SHF' as __s32 (32 bits).

Detailed Description

Composite operations on signed long integers for non-i386 architectures.

Definition in file qos_l_other.h.


Define Documentation

#define l_mul_div ( x,
num,
den   )     ((__s32) (((__s64) ((__s32)(x))) * ((__s32)(num)) / ((__s32)(den))))

Computes '(x * num) / den' as __s32 (32 bits).

Computation is carried on with intermediate result (x * num) on 64 bits.

Parameters:
x an __s32 integer (32 bits)
num an __s32 integer (32 bits)
den an __s32 integer (32 bits)
Returns:
the result as an __s32 integer (32 bits)
Note:
No overflow check is made after the division.
Todo:
Investigate on volatiles, that do not allow optimizations. They should not be required, but without them bw2Q(), which uses l_mul_shr, outputs zero instead of the correct value.

Definition at line 55 of file qos_l_other.h.

#define l_mul_shr ( x,
y,
SHF   )     ((__s32) ((((__s64) ((__s32)(x))) * ((__s32)(y))) >> (SHF)))

Computes '(x * y) >> SHF' as __s32 (32 bits).

The computation is carried on with intermediate result (x*y) on 64 bits.

This macro is useful for multiplying two integers where one of them represents a real in fixed precision with SHF decimal bits (i.e. 1.0 is represented as 1ul<<SHF).

Parameters:
x an __s32 integer (32 bits)
y an __s32 integer (32 bits)
SHF a macro which evaluates to an integer within 1 and 31
Returns:
the result as an __s32 integer (32 bits)
Note:
No overflow check is made after the shift.
Todo:
Investigate on volatiles, that do not allow optimizations. They should not be required, but without them bw2Q(), which uses l_mul_shr, outputs zero instead of the correct value.

Definition at line 83 of file qos_l_other.h.

#define l_shl_div ( num,
SHF,
den   )     ((__s32) ((((__s64) ((__s32)(num))) << (SHF)) / ((__s32)(den))))

Computes '(num << SHF) / den' as __s32.

Computation is carried on with intermediate result (num << SHF) on 64 bits. This macro is useful for representing the result of the division num/dev as a real in fixed precision with SHF decimal bits (i.e. 1.0 is represented as 1ul<<SHF).

Parameters:
num an __s32 integer (32 bits)
SHF a macro which evaluates to an integer within 1 and 31
den an __s32 integer (32 bits)
Returns:
the result as an __s32 integer (32 bits)
Note:
No overflow check is made after the division.
Todo:
Investigate on volatiles, that do not allow optimizations. They should not be required, but without them bw2Q(), which uses l_mul_shr, outputs zero instead of the correct value.

Definition at line 30 of file qos_l_other.h.

Generated on Mon Aug 2 22:39:17 2010 for qosres by  doxygen 1.6.3