author | ihse |
Tue, 13 Feb 2018 10:37:33 +0100 | |
branch | ihse-remove-mapfiles-branch |
changeset 56106 | 40e61db323c2 |
parent 47216 | 71c04702a3d5 |
child 56721 | 01b558efd286 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
56106 | 2 |
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
56106 | 26 |
#include "jni.h" |
2 | 27 |
#include "AlphaMath.h" |
28 |
||
29 |
unsigned char mul8table[256][256]; |
|
56106 | 30 |
JNIEXPORT unsigned char div8table[256][256]; |
2 | 31 |
|
32 |
void initAlphaTables() |
|
33 |
{ |
|
34 |
unsigned int i; |
|
35 |
unsigned int j; |
|
36 |
||
37 |
for (i = 1; i < 256; i++) { /* SCALE == (1 << 24) */ |
|
39550
8d587cab45d2
8160294: Some client libraries cannot be built with GCC 6
ysuenaga
parents:
26751
diff
changeset
|
38 |
unsigned int inc = (i << 16) + (i<<8) + i; /* approx. SCALE * (i/255.0) */ |
8d587cab45d2
8160294: Some client libraries cannot be built with GCC 6
ysuenaga
parents:
26751
diff
changeset
|
39 |
unsigned int val = inc + (1 << 23); /* inc + SCALE*0.5 */ |
2 | 40 |
for (j = 1; j < 256; j++) { |
41 |
mul8table[i][j] = (val >> 24); /* val / SCALE */ |
|
42 |
val += inc; |
|
43 |
} |
|
44 |
} |
|
45 |
||
46 |
for (i = 1; i < 256; i++) { |
|
47 |
unsigned int inc; |
|
48 |
unsigned int val; |
|
49 |
inc = 0xff; |
|
50 |
inc = ((inc << 24) + i/2) / i; |
|
51 |
val = (1 << 23); |
|
52 |
for (j = 0; j < i; j++) { |
|
53 |
div8table[i][j] = (val >> 24); |
|
54 |
val += inc; |
|
55 |
} |
|
56 |
for (j = i; j < 256; j++) { |
|
57 |
div8table[i][j] = 255; |
|
58 |
} |
|
59 |
} |
|
60 |
} |