> Looks like they do operations with 16-bit integers. I'd as soon go with > 32-bit ones--wastes a little space, but should be faster. (Except where we > should shift to 64-bit words) Using 32/31-bit requires general support of 64-bit arithmetics, for shift and multiply. Without it, we have to use some extremely complicated code to deal with multiply/division/shift, and we will lose the speed. Detecting overflow for 2's complement signed integer addtion/substract will be easy: c = a + b; if (((c ^ a) & (c ^ b)) < 0) { /* overflow */ } The code is super-scalar and need only one branch. It is also fast to generate boolean flag without using branch: int overflow = ((unsigned) ((c ^ a) & (c ^ b))) >> 31; Hong
- Re: PDD 4: Internal data types Buddha Buck
- Re: PDD 4: Internal data types Simon Cozens
- Re: PDD 4: Internal data types David Mitchell
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Nicholas Clark
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Nicholas Clark
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Hong Zhang
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Hong Zhang
- Re: PDD 4: Internal data types Nicholas Clark
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Nicholas Clark
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Hong Zhang
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types Bryan C. Warnock
- Re: PDD 4: Internal data types Dan Sugalski
- Re: PDD 4: Internal data types David Mitchell