#include <stdio.h>
#include <assert.h>
#include "private.h"
#include "gsm.h"
#include "proto.h"
Go to the source code of this file.
|
word gsm_norm | P1 ((a), longword a) |
|
word gsm_abs | P1 ((a), word a) |
|
longword gsm_L_add | P2 ((a, b), longword a, longword b) |
|
word gsm_add | P2 ((a, b), word a, word b) |
|
longword gsm_L_asl | P2 ((a, n), longword a, int n) |
|
word gsm_asl | P2 ((a, n), word a, int n) |
|
word gsm_div | P2 ((num, denum), word num, word denum) |
|
|
static unsigned char const | bitoff [256] |
|
◆ saturate
Definition at line 20 of file add.c.
◆ P1() [1/2]
Definition at line 117 of file add.c.
136{
138
140 if (
a <= -1073741824)
return 0;
142 }
143
144 return a & 0xffff0000
146 ? -1 +
bitoff[ 0xFF & (
a >> 24) ]
147 : 7 +
bitoff[ 0xFF & (
a >> 16) ] )
149 ? 15 +
bitoff[ 0xFF & (
a >> 8) ]
151}
static unsigned char const bitoff[256]
References a, and bitoff.
◆ P1() [2/2]
◆ P2() [1/5]
◆ P2() [2/5]
◆ P2() [3/5]
Definition at line 153 of file add.c.
154{
155 if (n >= 32) return 0;
156 if (n <= -32)
return -(
a < 0);
157 if (n < 0)
return gsm_L_asr(
a, -n);
159}
References a.
◆ P2() [4/5]
Definition at line 161 of file add.c.
162{
163 if (n >= 16) return 0;
164 if (n <= -16)
return -(
a < 0);
165 if (n < 0)
return gsm_asr(
a, -n);
167}
References a.
◆ P2() [5/5]
Definition at line 206 of file add.c.
207{
211 int k = 15;
212
213
214
215
216
217
218
219
220 assert(num >= 0 && denum >= num);
221 if (num == 0)
222 return 0;
223
224 while (k--) {
225 div <<= 1;
226 L_num <<= 1;
227
228 if (L_num >= L_denum) {
229 L_num -= L_denum;
230 div++;
231 }
232 }
233
234 return div;
235}
◆ bitoff
unsigned char const bitoff[256] |
|
static |
Definition at line 98 of file add.c.
Referenced by P1().