Boost logo

Boost :

From: Maxim Shemanarev (mcseem_at_[hidden])
Date: 2002-08-22 00:49:00


> For the following code
>
> typedef unsigned __int32 uword;
> typedef unsigned __int64 ulong;
>
> ulong mul(uword a, uword b, uword c) {
> return (ulong)a * b;
> }
>
> the old C compiler on my machine emits
>
> mov eax, DWORD PTR _b$[esp-4]
> mul DWORD PTR _a$[esp-4]
>
> which is as good as it gets.

Great! Can I ask you to try this:

uword c = 900000;
uword y = mul(123456, 654321) / c;

(I believe c-argument in your function is just a misprint)
If it generates only 3 asm-instructions (assuming that mul() is inline) it'd
be great. Still, I would *not* rely on it because there's no strictly
defined syntax.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk