Mercurial > libavcodec.hg
comparison mathops.h @ 11018:5f2c4bcf6e6e libavcodec
Add UMULH()
This function/macro returns the high half of the unsigned 64-bit
product of two unsigned 32-bit operands.
| author | mru |
|---|---|
| date | Tue, 26 Jan 2010 18:05:55 +0000 |
| parents | 38b3b209b4bc |
| children | cd8a77473dd1 |
comparison
equal
deleted
inserted
replaced
| 11017:aa10bb3c244c | 11018:5f2c4bcf6e6e |
|---|---|
| 48 //gcc 3.4 creates an incredibly bloated mess out of this | 48 //gcc 3.4 creates an incredibly bloated mess out of this |
| 49 //# define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32) | 49 //# define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32) |
| 50 | 50 |
| 51 static av_always_inline int MULH(int a, int b){ | 51 static av_always_inline int MULH(int a, int b){ |
| 52 return ((int64_t)(a) * (int64_t)(b))>>32; | 52 return ((int64_t)(a) * (int64_t)(b))>>32; |
| 53 } | |
| 54 #endif | |
| 55 | |
| 56 #ifndef UMULH | |
| 57 static av_always_inline unsigned UMULH(unsigned a, unsigned b){ | |
| 58 return ((uint64_t)(a) * (uint64_t)(b))>>32; | |
| 53 } | 59 } |
| 54 #endif | 60 #endif |
| 55 | 61 |
| 56 #ifndef MUL64 | 62 #ifndef MUL64 |
| 57 # define MUL64(a,b) ((int64_t)(a) * (int64_t)(b)) | 63 # define MUL64(a,b) ((int64_t)(a) * (int64_t)(b)) |
