reaction/ta_ui/vm/bg_lib.asm
2002-01-08 05:45:06 +00:00

5890 lines
88 KiB
NASM

code
proc swapfunc 24 0
file "../../game/bg_lib.c"
line 96
;1://-----------------------------------------------------------------------------
;2://
;3:// $Id$
;4://
;5://-----------------------------------------------------------------------------
;6://
;7:// $Log$
;7:// Revision 1.1 2002/01/08 05:46:17 blaze
;7:// Initial revision
;7://
;8:// Revision 1.4 2001/12/31 16:28:42 jbravo
;9:// I made a Booboo with the Log tag.
;10://
;11://
;12://-----------------------------------------------------------------------------
;13:// Copyright (C) 1999-2000 Id Software, Inc.
;14://
;15:// Copyright (C) 1999-2000 Id Software, Inc.
;16://
;17:// bg_lib,c -- standard C library replacement routines used by code
;18:// compiled for the virtual machine
;19:
;20:#include "q_shared.h"
;21:
;22:/*-
;23: * Copyright (c) 1992, 1993
;24: * The Regents of the University of California. All rights reserved.
;25: *
;26: * Redistribution and use in source and binary forms, with or without
;27: * modification, are permitted provided that the following conditions
;28: * are met:
;29: * 1. Redistributions of source code must retain the above copyright
;30: * notice, this list of conditions and the following disclaimer.
;31: * 2. Redistributions in binary form must reproduce the above copyright
;32: * notice, this list of conditions and the following disclaimer in the
;33: * documentation and/or other materials provided with the distribution.
;34: * 3. All advertising materials mentioning features or use of this software
;35: * must display the following acknowledgement:
;36: * This product includes software developed by the University of
;37: * California, Berkeley and its contributors.
;38: * 4. Neither the name of the University nor the names of its contributors
;39: * may be used to endorse or promote products derived from this software
;40: * without specific prior written permission.
;41: *
;42: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
;43: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;44: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;45: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
;46: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;47: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
;48: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
;49: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
;50: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
;51: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
;52: * SUCH DAMAGE.
;53: */
;54:
;55:#if defined(LIBC_SCCS) && !defined(lint)
;56:#if 0
;57:static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93";
;58:#endif
;59:static const char rcsid[] =
;60: "$Id$";
;61:#endif /* LIBC_SCCS and not lint */
;62:
;63:// bk001127 - needed for DLL's
;64:#if !defined( Q3_VM )
;65:typedef int cmp_t(const void *, const void *);
;66:#endif
;67:
;68:static char* med3(char *, char *, char *, cmp_t *);
;69:static void swapfunc(char *, char *, int, int);
;70:
;71:#ifndef min
;72:#define min(a, b) (a) < (b) ? a : b
;73:#endif
;74:
;75:/*
;76: * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
;77: */
;78:#define swapcode(TYPE, parmi, parmj, n) { \
;79: long i = (n) / sizeof (TYPE); \
;80: register TYPE *pi = (TYPE *) (parmi); \
;81: register TYPE *pj = (TYPE *) (parmj); \
;82: do { \
;83: register TYPE t = *pi; \
;84: *pi++ = *pj; \
;85: *pj++ = t; \
;86: } while (--i > 0); \
;87:}
;88:
;89:#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \
;90: es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
;91:
;92:static void
;93:swapfunc(a, b, n, swaptype)
;94: char *a, *b;
;95: int n, swaptype;
;96:{
line 97
;97: if(swaptype <= 1)
ADDRFP4 12
INDIRI4
CNSTI4 1
GTI4 $23
line 98
;98: swapcode(long, a, b, n)
ADDRLP4 8
ADDRFP4 8
INDIRI4
CVIU4 4
CNSTI4 2
RSHU4
CVUI4 4
ASGNI4
ADDRLP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 4
ADDRFP4 4
INDIRP4
ASGNP4
LABELV $25
ADDRLP4 12
ADDRLP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 16
ADDRLP4 0
INDIRP4
ASGNP4
ADDRLP4 0
ADDRLP4 16
INDIRP4
CNSTI4 4
ADDP4
ASGNP4
ADDRLP4 16
INDIRP4
ADDRLP4 4
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 20
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 20
INDIRP4
CNSTI4 4
ADDP4
ASGNP4
ADDRLP4 20
INDIRP4
ADDRLP4 12
INDIRI4
ASGNI4
LABELV $26
ADDRLP4 12
ADDRLP4 8
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
ADDRLP4 8
ADDRLP4 12
INDIRI4
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 0
GTI4 $25
ADDRGP4 $24
JUMPV
LABELV $23
line 100
;99: else
;100: swapcode(char, a, b, n)
ADDRLP4 8
ADDRFP4 8
INDIRI4
CVIU4 4
CVUI4 4
ASGNI4
ADDRLP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRLP4 4
ADDRFP4 4
INDIRP4
ASGNP4
LABELV $28
ADDRLP4 12
ADDRLP4 0
INDIRP4
INDIRI1
ASGNI1
ADDRLP4 16
ADDRLP4 0
INDIRP4
ASGNP4
ADDRLP4 0
ADDRLP4 16
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 16
INDIRP4
ADDRLP4 4
INDIRP4
INDIRI1
ASGNI1
ADDRLP4 20
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 20
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 20
INDIRP4
ADDRLP4 12
INDIRI1
ASGNI1
LABELV $29
ADDRLP4 12
ADDRLP4 8
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
ADDRLP4 8
ADDRLP4 12
INDIRI4
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 0
GTI4 $28
LABELV $24
line 101
;101:}
LABELV $22
endproc swapfunc 24 0
proc med3 40 8
line 117
;102:
;103:#define swap(a, b) \
;104: if (swaptype == 0) { \
;105: long t = *(long *)(a); \
;106: *(long *)(a) = *(long *)(b); \
;107: *(long *)(b) = t; \
;108: } else \
;109: swapfunc(a, b, es, swaptype)
;110:
;111:#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
;112:
;113:static char *
;114:med3(a, b, c, cmp)
;115: char *a, *b, *c;
;116: cmp_t *cmp;
;117:{
line 118
;118: return cmp(a, b) < 0 ?
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 4
INDIRP4
ARGP4
ADDRLP4 20
ADDRFP4 12
INDIRP4
CALLI4
ASGNI4
ADDRLP4 20
INDIRI4
CNSTI4 0
GEI4 $37
ADDRFP4 4
INDIRP4
ARGP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRLP4 24
ADDRFP4 12
INDIRP4
CALLI4
ASGNI4
ADDRLP4 24
INDIRI4
CNSTI4 0
GEI4 $39
ADDRLP4 4
ADDRFP4 4
INDIRP4
ASGNP4
ADDRGP4 $40
JUMPV
LABELV $39
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRLP4 28
ADDRFP4 12
INDIRP4
CALLI4
ASGNI4
ADDRLP4 28
INDIRI4
CNSTI4 0
GEI4 $41
ADDRLP4 8
ADDRFP4 8
INDIRP4
ASGNP4
ADDRGP4 $42
JUMPV
LABELV $41
ADDRLP4 8
ADDRFP4 0
INDIRP4
ASGNP4
LABELV $42
ADDRLP4 4
ADDRLP4 8
INDIRP4
ASGNP4
LABELV $40
ADDRLP4 0
ADDRLP4 4
INDIRP4
ASGNP4
ADDRGP4 $38
JUMPV
LABELV $37
ADDRFP4 4
INDIRP4
ARGP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRLP4 32
ADDRFP4 12
INDIRP4
CALLI4
ASGNI4
ADDRLP4 32
INDIRI4
CNSTI4 0
LEI4 $43
ADDRLP4 12
ADDRFP4 4
INDIRP4
ASGNP4
ADDRGP4 $44
JUMPV
LABELV $43
ADDRFP4 0
INDIRP4
ARGP4
ADDRFP4 8
INDIRP4
ARGP4
ADDRLP4 36
ADDRFP4 12
INDIRP4
CALLI4
ASGNI4
ADDRLP4 36
INDIRI4
CNSTI4 0
GEI4 $45
ADDRLP4 16
ADDRFP4 0
INDIRP4
ASGNP4
ADDRGP4 $46
JUMPV
LABELV $45
ADDRLP4 16
ADDRFP4 8
INDIRP4
ASGNP4
LABELV $46
ADDRLP4 12
ADDRLP4 16
INDIRP4
ASGNP4
LABELV $44
ADDRLP4 0
ADDRLP4 12
INDIRP4
ASGNP4
LABELV $38
ADDRLP4 0
INDIRP4
RETP4
LABELV $31
endproc med3 40 8
export qsort
proc qsort 104 16
line 128
;119: (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a ))
;120: :(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c ));
;121:}
;122:
;123:void
;124:qsort(a, n, es, cmp)
;125: void *a;
;126: size_t n, es;
;127: cmp_t *cmp;
;128:{
LABELV $48
line 132
;129: char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
;130: int d, r, swaptype, swap_cnt;
;131:
;132:loop: SWAPINIT(a, es);
ADDRLP4 52
CNSTU4 3
ASGNU4
ADDRLP4 56
CNSTU4 0
ASGNU4
ADDRFP4 0
INDIRP4
CVPU4 4
CVUI4 4
CVIU4 4
ADDRLP4 52
INDIRU4
BANDU4
ADDRLP4 56
INDIRU4
NEU4 $53
ADDRFP4 8
INDIRI4
CVIU4 4
ADDRLP4 52
INDIRU4
BANDU4
ADDRLP4 56
INDIRU4
EQU4 $51
LABELV $53
ADDRLP4 44
CNSTI4 2
ASGNI4
ADDRGP4 $52
JUMPV
LABELV $51
ADDRFP4 8
INDIRI4
CVIU4 4
CNSTU4 4
NEU4 $54
ADDRLP4 48
CNSTI4 0
ASGNI4
ADDRGP4 $55
JUMPV
LABELV $54
ADDRLP4 48
CNSTI4 1
ASGNI4
LABELV $55
ADDRLP4 44
ADDRLP4 48
INDIRI4
ASGNI4
LABELV $52
ADDRLP4 16
ADDRLP4 44
INDIRI4
ASGNI4
line 133
;133: swap_cnt = 0;
ADDRLP4 28
CNSTI4 0
ASGNI4
line 134
;134: if (n < 7) {
ADDRFP4 4
INDIRI4
CNSTI4 7
GEI4 $56
line 135
;135: for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
ADDRLP4 32
ADDRFP4 8
INDIRI4
ADDRFP4 0
INDIRP4
ADDP4
ASGNP4
ADDRGP4 $61
JUMPV
LABELV $58
line 136
;136: for (pl = pm; pl > (char *)a && cmp(pl - es, pl) > 0;
ADDRLP4 0
ADDRLP4 32
INDIRP4
ASGNP4
ADDRGP4 $65
JUMPV
LABELV $62
line 138
;137: pl -= es)
;138: swap(pl, pl - es);
ADDRLP4 16
INDIRI4
CNSTI4 0
NEI4 $66
ADDRLP4 60
ADDRLP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 0
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
ADDRLP4 60
INDIRI4
ASGNI4
ADDRGP4 $67
JUMPV
LABELV $66
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 64
ADDRFP4 8
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 64
INDIRI4
SUBP4
ARGP4
ADDRLP4 64
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 swapfunc
CALLV
pop
LABELV $67
LABELV $63
line 137
ADDRLP4 0
ADDRLP4 0
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
ASGNP4
LABELV $65
line 136
ADDRLP4 0
INDIRP4
CVPU4 4
ADDRFP4 0
INDIRP4
CVPU4 4
LEU4 $68
ADDRLP4 0
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
ARGP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 72
ADDRFP4 12
INDIRP4
CALLI4
ASGNI4
ADDRLP4 72
INDIRI4
CNSTI4 0
GTI4 $62
LABELV $68
LABELV $59
line 135
ADDRLP4 32
ADDRFP4 8
INDIRI4
ADDRLP4 32
INDIRP4
ADDP4
ASGNP4
LABELV $61
ADDRLP4 32
INDIRP4
CVPU4 4
ADDRFP4 4
INDIRI4
ADDRFP4 8
INDIRI4
MULI4
ADDRFP4 0
INDIRP4
ADDP4
CVPU4 4
LTU4 $58
line 139
;139: return;
ADDRGP4 $47
JUMPV
LABELV $56
line 141
;140: }
;141: pm = (char *)a + (n / 2) * es;
ADDRLP4 32
ADDRFP4 4
INDIRI4
CNSTI4 2
DIVI4
ADDRFP4 8
INDIRI4
MULI4
ADDRFP4 0
INDIRP4
ADDP4
ASGNP4
line 142
;142: if (n > 7) {
ADDRFP4 4
INDIRI4
CNSTI4 7
LEI4 $69
line 143
;143: pl = a;
ADDRLP4 0
ADDRFP4 0
INDIRP4
ASGNP4
line 144
;144: pn = (char *)a + (n - 1) * es;
ADDRLP4 36
ADDRFP4 4
INDIRI4
CNSTI4 1
SUBI4
ADDRFP4 8
INDIRI4
MULI4
ADDRFP4 0
INDIRP4
ADDP4
ASGNP4
line 145
;145: if (n > 40) {
ADDRFP4 4
INDIRI4
CNSTI4 40
LEI4 $71
line 146
;146: d = (n / 8) * es;
ADDRLP4 40
ADDRFP4 4
INDIRI4
CNSTI4 8
DIVI4
ADDRFP4 8
INDIRI4
MULI4
ASGNI4
line 147
;147: pl = med3(pl, pl + d, pl + 2 * d, cmp);
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 64
ADDRLP4 40
INDIRI4
ASGNI4
ADDRLP4 64
INDIRI4
ADDRLP4 0
INDIRP4
ADDP4
ARGP4
ADDRLP4 64
INDIRI4
CNSTI4 1
LSHI4
ADDRLP4 0
INDIRP4
ADDP4
ARGP4
ADDRFP4 12
INDIRP4
ARGP4
ADDRLP4 68
ADDRGP4 med3
CALLP4
ASGNP4
ADDRLP4 0
ADDRLP4 68
INDIRP4
ASGNP4
line 148
;148: pm = med3(pm - d, pm, pm + d, cmp);
ADDRLP4 76
ADDRLP4 40
INDIRI4
ASGNI4
ADDRLP4 32
INDIRP4
ADDRLP4 76
INDIRI4
SUBP4
ARGP4
ADDRLP4 32
INDIRP4
ARGP4
ADDRLP4 76
INDIRI4
ADDRLP4 32
INDIRP4
ADDP4
ARGP4
ADDRFP4 12
INDIRP4
ARGP4
ADDRLP4 80
ADDRGP4 med3
CALLP4
ASGNP4
ADDRLP4 32
ADDRLP4 80
INDIRP4
ASGNP4
line 149
;149: pn = med3(pn - 2 * d, pn - d, pn, cmp);
ADDRLP4 88
ADDRLP4 40
INDIRI4
ASGNI4
ADDRLP4 36
INDIRP4
ADDRLP4 88
INDIRI4
CNSTI4 1
LSHI4
SUBP4
ARGP4
ADDRLP4 36
INDIRP4
ADDRLP4 88
INDIRI4
SUBP4
ARGP4
ADDRLP4 36
INDIRP4
ARGP4
ADDRFP4 12
INDIRP4
ARGP4
ADDRLP4 92
ADDRGP4 med3
CALLP4
ASGNP4
ADDRLP4 36
ADDRLP4 92
INDIRP4
ASGNP4
line 150
;150: }
LABELV $71
line 151
;151: pm = med3(pl, pm, pn, cmp);
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 32
INDIRP4
ARGP4
ADDRLP4 36
INDIRP4
ARGP4
ADDRFP4 12
INDIRP4
ARGP4
ADDRLP4 60
ADDRGP4 med3
CALLP4
ASGNP4
ADDRLP4 32
ADDRLP4 60
INDIRP4
ASGNP4
line 152
;152: }
LABELV $69
line 153
;153: swap(a, pm);
ADDRLP4 16
INDIRI4
CNSTI4 0
NEI4 $73
ADDRLP4 60
ADDRFP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRFP4 0
INDIRP4
ADDRLP4 32
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 32
INDIRP4
ADDRLP4 60
INDIRI4
ASGNI4
ADDRGP4 $74
JUMPV
LABELV $73
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 32
INDIRP4
ARGP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 swapfunc
CALLV
pop
LABELV $74
line 154
;154: pa = pb = (char *)a + es;
ADDRLP4 60
ADDRFP4 8
INDIRI4
ADDRFP4 0
INDIRP4
ADDP4
ASGNP4
ADDRLP4 4
ADDRLP4 60
INDIRP4
ASGNP4
ADDRLP4 20
ADDRLP4 60
INDIRP4
ASGNP4
line 156
;155:
;156: pc = pd = (char *)a + (n - 1) * es;
ADDRLP4 64
ADDRFP4 4
INDIRI4
CNSTI4 1
SUBI4
ADDRFP4 8
INDIRI4
MULI4
ADDRFP4 0
INDIRP4
ADDP4
ASGNP4
ADDRLP4 24
ADDRLP4 64
INDIRP4
ASGNP4
ADDRLP4 8
ADDRLP4 64
INDIRP4
ASGNP4
line 157
;157: for (;;) {
ADDRGP4 $80
JUMPV
LABELV $79
line 158
;158: while (pb <= pc && (r = cmp(pb, a)) <= 0) {
line 159
;159: if (r == 0) {
ADDRLP4 12
INDIRI4
CNSTI4 0
NEI4 $82
line 160
;160: swap_cnt = 1;
ADDRLP4 28
CNSTI4 1
ASGNI4
line 161
;161: swap(pa, pb);
ADDRLP4 16
INDIRI4
CNSTI4 0
NEI4 $84
ADDRLP4 68
ADDRLP4 20
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 20
INDIRP4
ADDRLP4 4
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 4
INDIRP4
ADDRLP4 68
INDIRI4
ASGNI4
ADDRGP4 $85
JUMPV
LABELV $84
ADDRLP4 20
INDIRP4
ARGP4
ADDRLP4 4
INDIRP4
ARGP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 swapfunc
CALLV
pop
LABELV $85
line 162
;162: pa += es;
ADDRLP4 20
ADDRFP4 8
INDIRI4
ADDRLP4 20
INDIRP4
ADDP4
ASGNP4
line 163
;163: }
LABELV $82
line 164
;164: pb += es;
ADDRLP4 4
ADDRFP4 8
INDIRI4
ADDRLP4 4
INDIRP4
ADDP4
ASGNP4
line 165
;165: }
LABELV $80
line 158
ADDRLP4 4
INDIRP4
CVPU4 4
ADDRLP4 8
INDIRP4
CVPU4 4
GTU4 $86
ADDRLP4 4
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 72
ADDRFP4 12
INDIRP4
CALLI4
ASGNI4
ADDRLP4 12
ADDRLP4 72
INDIRI4
ASGNI4
ADDRLP4 72
INDIRI4
CNSTI4 0
LEI4 $79
LABELV $86
ADDRGP4 $88
JUMPV
LABELV $87
line 166
;166: while (pb <= pc && (r = cmp(pc, a)) >= 0) {
line 167
;167: if (r == 0) {
ADDRLP4 12
INDIRI4
CNSTI4 0
NEI4 $90
line 168
;168: swap_cnt = 1;
ADDRLP4 28
CNSTI4 1
ASGNI4
line 169
;169: swap(pc, pd);
ADDRLP4 16
INDIRI4
CNSTI4 0
NEI4 $92
ADDRLP4 76
ADDRLP4 8
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 8
INDIRP4
ADDRLP4 24
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 24
INDIRP4
ADDRLP4 76
INDIRI4
ASGNI4
ADDRGP4 $93
JUMPV
LABELV $92
ADDRLP4 8
INDIRP4
ARGP4
ADDRLP4 24
INDIRP4
ARGP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 swapfunc
CALLV
pop
LABELV $93
line 170
;170: pd -= es;
ADDRLP4 24
ADDRLP4 24
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
ASGNP4
line 171
;171: }
LABELV $90
line 172
;172: pc -= es;
ADDRLP4 8
ADDRLP4 8
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
ASGNP4
line 173
;173: }
LABELV $88
line 166
ADDRLP4 4
INDIRP4
CVPU4 4
ADDRLP4 8
INDIRP4
CVPU4 4
GTU4 $94
ADDRLP4 8
INDIRP4
ARGP4
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 80
ADDRFP4 12
INDIRP4
CALLI4
ASGNI4
ADDRLP4 12
ADDRLP4 80
INDIRI4
ASGNI4
ADDRLP4 80
INDIRI4
CNSTI4 0
GEI4 $87
LABELV $94
line 174
;174: if (pb > pc)
ADDRLP4 4
INDIRP4
CVPU4 4
ADDRLP4 8
INDIRP4
CVPU4 4
LEU4 $95
line 175
;175: break;
ADDRGP4 $77
JUMPV
LABELV $95
line 176
;176: swap(pb, pc);
ADDRLP4 16
INDIRI4
CNSTI4 0
NEI4 $97
ADDRLP4 84
ADDRLP4 4
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 4
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 8
INDIRP4
ADDRLP4 84
INDIRI4
ASGNI4
ADDRGP4 $98
JUMPV
LABELV $97
ADDRLP4 4
INDIRP4
ARGP4
ADDRLP4 8
INDIRP4
ARGP4
ADDRFP4 8
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 swapfunc
CALLV
pop
LABELV $98
line 177
;177: swap_cnt = 1;
ADDRLP4 28
CNSTI4 1
ASGNI4
line 178
;178: pb += es;
ADDRLP4 4
ADDRFP4 8
INDIRI4
ADDRLP4 4
INDIRP4
ADDP4
ASGNP4
line 179
;179: pc -= es;
ADDRLP4 8
ADDRLP4 8
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
ASGNP4
line 180
;180: }
line 157
ADDRGP4 $80
JUMPV
LABELV $77
line 181
;181: if (swap_cnt == 0) { /* Switch to insertion sort */
ADDRLP4 28
INDIRI4
CNSTI4 0
NEI4 $99
line 182
;182: for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
ADDRLP4 32
ADDRFP4 8
INDIRI4
ADDRFP4 0
INDIRP4
ADDP4
ASGNP4
ADDRGP4 $104
JUMPV
LABELV $101
line 183
;183: for (pl = pm; pl > (char *)a && cmp(pl - es, pl) > 0;
ADDRLP4 0
ADDRLP4 32
INDIRP4
ASGNP4
ADDRGP4 $108
JUMPV
LABELV $105
line 185
;184: pl -= es)
;185: swap(pl, pl - es);
ADDRLP4 16
INDIRI4
CNSTI4 0
NEI4 $109
ADDRLP4 68
ADDRLP4 0
INDIRP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 0
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
ADDRLP4 68
INDIRI4
ASGNI4
ADDRGP4 $110
JUMPV
LABELV $109
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 72
ADDRFP4 8
INDIRI4
ASGNI4
ADDRLP4 0
INDIRP4
ADDRLP4 72
INDIRI4
SUBP4
ARGP4
ADDRLP4 72
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 swapfunc
CALLV
pop
LABELV $110
LABELV $106
line 184
ADDRLP4 0
ADDRLP4 0
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
ASGNP4
LABELV $108
line 183
ADDRLP4 0
INDIRP4
CVPU4 4
ADDRFP4 0
INDIRP4
CVPU4 4
LEU4 $111
ADDRLP4 0
INDIRP4
ADDRFP4 8
INDIRI4
SUBP4
ARGP4
ADDRLP4 0
INDIRP4
ARGP4
ADDRLP4 80
ADDRFP4 12
INDIRP4
CALLI4
ASGNI4
ADDRLP4 80
INDIRI4
CNSTI4 0
GTI4 $105
LABELV $111
LABELV $102
line 182
ADDRLP4 32
ADDRFP4 8
INDIRI4
ADDRLP4 32
INDIRP4
ADDP4
ASGNP4
LABELV $104
ADDRLP4 32
INDIRP4
CVPU4 4
ADDRFP4 4
INDIRI4
ADDRFP4 8
INDIRI4
MULI4
ADDRFP4 0
INDIRP4
ADDP4
CVPU4 4
LTU4 $101
line 186
;186: return;
ADDRGP4 $47
JUMPV
LABELV $99
line 189
;187: }
;188:
;189: pn = (char *)a + n * es;
ADDRLP4 36
ADDRFP4 4
INDIRI4
ADDRFP4 8
INDIRI4
MULI4
ADDRFP4 0
INDIRP4
ADDP4
ASGNP4
line 190
;190: r = min(pa - (char *)a, pb - pa);
ADDRLP4 72
ADDRLP4 20
INDIRP4
CVPU4 4
ASGNU4
ADDRLP4 72
INDIRU4
ADDRFP4 0
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
ADDRLP4 4
INDIRP4
CVPU4 4
ADDRLP4 72
INDIRU4
SUBU4
CVUI4 4
GEI4 $113
ADDRLP4 68
ADDRLP4 20
INDIRP4
CVPU4 4
ADDRFP4 0
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
ASGNI4
ADDRGP4 $114
JUMPV
LABELV $113
ADDRLP4 68
ADDRLP4 4
INDIRP4
CVPU4 4
ADDRLP4 20
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
ASGNI4
LABELV $114
ADDRLP4 12
ADDRLP4 68
INDIRI4
ASGNI4
line 191
;191: vecswap(a, pb - r, r);
ADDRLP4 12
INDIRI4
CNSTI4 0
LEI4 $115
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 4
INDIRP4
ADDRLP4 12
INDIRI4
SUBP4
ARGP4
ADDRLP4 12
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 swapfunc
CALLV
pop
LABELV $115
line 192
;192: r = min(pd - pc, pn - pd - es);
ADDRLP4 84
ADDRLP4 24
INDIRP4
CVPU4 4
ASGNU4
ADDRLP4 84
INDIRU4
ADDRLP4 8
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
ADDRLP4 36
INDIRP4
CVPU4 4
ADDRLP4 84
INDIRU4
SUBU4
CVUI4 4
ADDRFP4 8
INDIRI4
SUBI4
GEI4 $118
ADDRLP4 80
ADDRLP4 24
INDIRP4
CVPU4 4
ADDRLP4 8
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
ASGNI4
ADDRGP4 $119
JUMPV
LABELV $118
ADDRLP4 80
ADDRLP4 36
INDIRP4
CVPU4 4
ADDRLP4 24
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
ADDRFP4 8
INDIRI4
SUBI4
ASGNI4
LABELV $119
ADDRLP4 12
ADDRLP4 80
INDIRI4
ASGNI4
line 193
;193: vecswap(pb, pn - r, r);
ADDRLP4 12
INDIRI4
CNSTI4 0
LEI4 $120
ADDRLP4 4
INDIRP4
ARGP4
ADDRLP4 36
INDIRP4
ADDRLP4 12
INDIRI4
SUBP4
ARGP4
ADDRLP4 12
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 swapfunc
CALLV
pop
LABELV $120
line 194
;194: if ((r = pb - pa) > es)
ADDRLP4 92
ADDRLP4 4
INDIRP4
CVPU4 4
ADDRLP4 20
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
ASGNI4
ADDRLP4 12
ADDRLP4 92
INDIRI4
ASGNI4
ADDRLP4 92
INDIRI4
ADDRFP4 8
INDIRI4
LEI4 $122
line 195
;195: qsort(a, r / es, es, cmp);
ADDRFP4 0
INDIRP4
ARGP4
ADDRLP4 96
ADDRFP4 8
INDIRI4
ASGNI4
ADDRLP4 12
INDIRI4
ADDRLP4 96
INDIRI4
DIVI4
ARGI4
ADDRLP4 96
INDIRI4
ARGI4
ADDRFP4 12
INDIRP4
ARGP4
ADDRGP4 qsort
CALLV
pop
LABELV $122
line 196
;196: if ((r = pd - pc) > es) {
ADDRLP4 100
ADDRLP4 24
INDIRP4
CVPU4 4
ADDRLP4 8
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
ASGNI4
ADDRLP4 12
ADDRLP4 100
INDIRI4
ASGNI4
ADDRLP4 100
INDIRI4
ADDRFP4 8
INDIRI4
LEI4 $124
line 198
;197: /* Iterate rather than recurse to save stack space */
;198: a = pn - r;
ADDRFP4 0
ADDRLP4 36
INDIRP4
ADDRLP4 12
INDIRI4
SUBP4
ASGNP4
line 199
;199: n = r / es;
ADDRFP4 4
ADDRLP4 12
INDIRI4
ADDRFP4 8
INDIRI4
DIVI4
ASGNI4
line 200
;200: goto loop;
ADDRGP4 $48
JUMPV
LABELV $124
line 203
;201: }
;202:/* qsort(pn - r, r / es, es, cmp);*/
;203:}
LABELV $47
endproc qsort 104 16
export strlen
proc strlen 4 0
line 213
;204:
;205://==================================================================================
;206:
;207:
;208:// this file is excluded from release builds because of intrinsics
;209:
;210:// bk001211 - gcc errors on compiling strcpy: parse error before `__extension__'
;211:#if defined ( Q3_VM )
;212:
;213:size_t strlen( const char *string ) {
line 216
;214: const char *s;
;215:
;216: s = string;
ADDRLP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRGP4 $128
JUMPV
LABELV $127
line 217
;217: while ( *s ) {
line 218
;218: s++;
ADDRLP4 0
ADDRLP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 219
;219: }
LABELV $128
line 217
ADDRLP4 0
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $127
line 220
;220: return s - string;
ADDRLP4 0
INDIRP4
CVPU4 4
ADDRFP4 0
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
RETI4
LABELV $126
endproc strlen 4 0
export strcat
proc strcat 16 0
line 224
;221:}
;222:
;223:
;224:char *strcat( char *strDestination, const char *strSource ) {
line 227
;225: char *s;
;226:
;227: s = strDestination;
ADDRLP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRGP4 $132
JUMPV
LABELV $131
line 228
;228: while ( *s ) {
line 229
;229: s++;
ADDRLP4 0
ADDRLP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 230
;230: }
LABELV $132
line 228
ADDRLP4 0
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $131
ADDRGP4 $135
JUMPV
LABELV $134
line 231
;231: while ( *strSource ) {
line 232
;232: *s++ = *strSource++;
ADDRLP4 4
ADDRLP4 0
INDIRP4
ASGNP4
ADDRLP4 12
CNSTI4 1
ASGNI4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ADDRLP4 12
INDIRI4
ADDP4
ASGNP4
ADDRLP4 8
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 4
ADDRLP4 8
INDIRP4
ADDRLP4 12
INDIRI4
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI1
ASGNI1
line 233
;233: }
LABELV $135
line 231
ADDRFP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $134
line 234
;234: *s = 0;
ADDRLP4 0
INDIRP4
CNSTI1 0
ASGNI1
line 235
;235: return strDestination;
ADDRFP4 0
INDIRP4
RETP4
LABELV $130
endproc strcat 16 0
export strcpy
proc strcpy 16 0
line 238
;236:}
;237:
;238:char *strcpy( char *strDestination, const char *strSource ) {
line 241
;239: char *s;
;240:
;241: s = strDestination;
ADDRLP4 0
ADDRFP4 0
INDIRP4
ASGNP4
ADDRGP4 $139
JUMPV
LABELV $138
line 242
;242: while ( *strSource ) {
line 243
;243: *s++ = *strSource++;
ADDRLP4 4
ADDRLP4 0
INDIRP4
ASGNP4
ADDRLP4 12
CNSTI4 1
ASGNI4
ADDRLP4 0
ADDRLP4 4
INDIRP4
ADDRLP4 12
INDIRI4
ADDP4
ASGNP4
ADDRLP4 8
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 4
ADDRLP4 8
INDIRP4
ADDRLP4 12
INDIRI4
ADDP4
ASGNP4
ADDRLP4 4
INDIRP4
ADDRLP4 8
INDIRP4
INDIRI1
ASGNI1
line 244
;244: }
LABELV $139
line 242
ADDRFP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $138
line 245
;245: *s = 0;
ADDRLP4 0
INDIRP4
CNSTI1 0
ASGNI1
line 246
;246: return strDestination;
ADDRFP4 0
INDIRP4
RETP4
LABELV $137
endproc strcpy 16 0
export strcmp
proc strcmp 12 0
line 250
;247:}
;248:
;249:
;250:int strcmp( const char *string1, const char *string2 ) {
ADDRGP4 $143
JUMPV
LABELV $142
line 251
;251: while ( *string1 == *string2 && *string1 && *string2 ) {
line 252
;252: string1++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 253
;253: string2++;
ADDRFP4 4
ADDRFP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 254
;254: }
LABELV $143
line 251
ADDRLP4 0
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
ASGNI4
ADDRLP4 4
ADDRFP4 4
INDIRP4
INDIRI1
CVII4 1
ASGNI4
ADDRLP4 0
INDIRI4
ADDRLP4 4
INDIRI4
NEI4 $146
ADDRLP4 8
CNSTI4 0
ASGNI4
ADDRLP4 0
INDIRI4
ADDRLP4 8
INDIRI4
EQI4 $146
ADDRLP4 4
INDIRI4
ADDRLP4 8
INDIRI4
NEI4 $142
LABELV $146
line 255
;255: return *string1 - *string2;
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
ADDRFP4 4
INDIRP4
INDIRI1
CVII4 1
SUBI4
RETI4
LABELV $141
endproc strcmp 12 0
export strchr
proc strchr 0 0
line 259
;256:}
;257:
;258:
;259:char *strchr( const char *string, int c ) {
ADDRGP4 $149
JUMPV
LABELV $148
line 260
;260: while ( *string ) {
line 261
;261: if ( *string == c ) {
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
ADDRFP4 4
INDIRI4
NEI4 $151
line 262
;262: return ( char * )string;
ADDRFP4 0
INDIRP4
RETP4
ADDRGP4 $147
JUMPV
LABELV $151
line 264
;263: }
;264: string++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 265
;265: }
LABELV $149
line 260
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $148
line 266
;266: return (char *)0;
CNSTP4 0
RETP4
LABELV $147
endproc strchr 0 0
export strstr
proc strstr 8 0
line 269
;267:}
;268:
;269:char *strstr( const char *string, const char *strCharSet ) {
ADDRGP4 $155
JUMPV
LABELV $154
line 270
;270: while ( *string ) {
line 273
;271: int i;
;272:
;273: for ( i = 0 ; strCharSet[i] ; i++ ) {
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $160
JUMPV
LABELV $157
line 274
;274: if ( string[i] != strCharSet[i] ) {
ADDRLP4 0
INDIRI4
ADDRFP4 0
INDIRP4
ADDP4
INDIRI1
CVII4 1
ADDRLP4 0
INDIRI4
ADDRFP4 4
INDIRP4
ADDP4
INDIRI1
CVII4 1
EQI4 $161
line 275
;275: break;
ADDRGP4 $159
JUMPV
LABELV $161
line 277
;276: }
;277: }
LABELV $158
line 273
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $160
ADDRLP4 0
INDIRI4
ADDRFP4 4
INDIRP4
ADDP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $157
LABELV $159
line 278
;278: if ( !strCharSet[i] ) {
ADDRLP4 0
INDIRI4
ADDRFP4 4
INDIRP4
ADDP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $163
line 279
;279: return (char *)string;
ADDRFP4 0
INDIRP4
RETP4
ADDRGP4 $153
JUMPV
LABELV $163
line 281
;280: }
;281: string++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 282
;282: }
LABELV $155
line 270
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $154
line 283
;283: return (char *)0;
CNSTP4 0
RETP4
LABELV $153
endproc strstr 8 0
export tolower
proc tolower 4 0
line 291
;284:}
;285:#endif // bk001211
;286:
;287:// bk001120 - presumably needed for Mac
;288://#if !defined(_MSC_VER) && !defined(__linux__)
;289:// bk001127 - undid undo
;290:#if defined ( Q3_VM )
;291:int tolower( int c ) {
line 292
;292: if ( c >= 'A' && c <= 'Z' ) {
ADDRLP4 0
ADDRFP4 0
INDIRI4
ASGNI4
ADDRLP4 0
INDIRI4
CNSTI4 65
LTI4 $166
ADDRLP4 0
INDIRI4
CNSTI4 90
GTI4 $166
line 293
;293: c += 'a' - 'A';
ADDRFP4 0
ADDRFP4 0
INDIRI4
CNSTI4 32
ADDI4
ASGNI4
line 294
;294: }
LABELV $166
line 295
;295: return c;
ADDRFP4 0
INDIRI4
RETI4
LABELV $165
endproc tolower 4 0
export toupper
proc toupper 4 0
line 299
;296:}
;297:
;298:
;299:int toupper( int c ) {
line 300
;300: if ( c >= 'a' && c <= 'z' ) {
ADDRLP4 0
ADDRFP4 0
INDIRI4
ASGNI4
ADDRLP4 0
INDIRI4
CNSTI4 97
LTI4 $169
ADDRLP4 0
INDIRI4
CNSTI4 122
GTI4 $169
line 301
;301: c += 'A' - 'a';
ADDRFP4 0
ADDRFP4 0
INDIRI4
CNSTI4 -32
ADDI4
ASGNI4
line 302
;302: }
LABELV $169
line 303
;303: return c;
ADDRFP4 0
INDIRI4
RETI4
LABELV $168
endproc toupper 4 0
export memmove
proc memmove 8 0
line 309
;304:}
;305:
;306:#endif
;307://#ifndef _MSC_VER
;308:
;309:void *memmove( void *dest, const void *src, size_t count ) {
line 312
;310: int i;
;311:
;312: if ( dest > src ) {
ADDRFP4 0
INDIRP4
CVPU4 4
ADDRFP4 4
INDIRP4
CVPU4 4
LEU4 $172
line 313
;313: for ( i = count-1 ; i >= 0 ; i-- ) {
ADDRLP4 0
ADDRFP4 8
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
ADDRGP4 $177
JUMPV
LABELV $174
line 314
;314: ((char *)dest)[i] = ((char *)src)[i];
ADDRLP4 0
INDIRI4
ADDRFP4 0
INDIRP4
ADDP4
ADDRLP4 0
INDIRI4
ADDRFP4 4
INDIRP4
ADDP4
INDIRI1
ASGNI1
line 315
;315: }
LABELV $175
line 313
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
LABELV $177
ADDRLP4 0
INDIRI4
CNSTI4 0
GEI4 $174
line 316
;316: } else {
ADDRGP4 $173
JUMPV
LABELV $172
line 317
;317: for ( i = 0 ; i < count ; i++ ) {
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $181
JUMPV
LABELV $178
line 318
;318: ((char *)dest)[i] = ((char *)src)[i];
ADDRLP4 0
INDIRI4
ADDRFP4 0
INDIRP4
ADDP4
ADDRLP4 0
INDIRI4
ADDRFP4 4
INDIRP4
ADDP4
INDIRI1
ASGNI1
line 319
;319: }
LABELV $179
line 317
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $181
ADDRLP4 0
INDIRI4
ADDRFP4 8
INDIRI4
LTI4 $178
line 320
;320: }
LABELV $173
line 321
;321: return dest;
ADDRFP4 0
INDIRP4
RETP4
LABELV $171
endproc memmove 8 0
export tan
proc tan 8 4
line 779
;322:}
;323:
;324:
;325:#if 0
;326:
;327:double floor( double x ) {
;328: return (int)(x + 0x40000000) - 0x40000000;
;329:}
;330:
;331:void *memset( void *dest, int c, size_t count ) {
;332: while ( count-- ) {
;333: ((char *)dest)[count] = c;
;334: }
;335: return dest;
;336:}
;337:
;338:void *memcpy( void *dest, const void *src, size_t count ) {
;339: while ( count-- ) {
;340: ((char *)dest)[count] = ((char *)src)[count];
;341: }
;342: return dest;
;343:}
;344:
;345:char *strncpy( char *strDest, const char *strSource, size_t count ) {
;346: char *s;
;347:
;348: s = strDest;
;349: while ( *strSource && count ) {
;350: *s++ = *strSource++;
;351: count--;
;352: }
;353: while ( count-- ) {
;354: *s++ = 0;
;355: }
;356: return strDest;
;357:}
;358:
;359:double sqrt( double x ) {
;360: float y;
;361: float delta;
;362: float maxError;
;363:
;364: if ( x <= 0 ) {
;365: return 0;
;366: }
;367:
;368: // initial guess
;369: y = x / 2;
;370:
;371: // refine
;372: maxError = x * 0.001;
;373:
;374: do {
;375: delta = ( y * y ) - x;
;376: y -= delta / ( 2 * y );
;377: } while ( delta > maxError || delta < -maxError );
;378:
;379: return y;
;380:}
;381:
;382:
;383:float sintable[1024] = {
;384:0.000000,0.001534,0.003068,0.004602,0.006136,0.007670,0.009204,0.010738,
;385:0.012272,0.013805,0.015339,0.016873,0.018407,0.019940,0.021474,0.023008,
;386:0.024541,0.026075,0.027608,0.029142,0.030675,0.032208,0.033741,0.035274,
;387:0.036807,0.038340,0.039873,0.041406,0.042938,0.044471,0.046003,0.047535,
;388:0.049068,0.050600,0.052132,0.053664,0.055195,0.056727,0.058258,0.059790,
;389:0.061321,0.062852,0.064383,0.065913,0.067444,0.068974,0.070505,0.072035,
;390:0.073565,0.075094,0.076624,0.078153,0.079682,0.081211,0.082740,0.084269,
;391:0.085797,0.087326,0.088854,0.090381,0.091909,0.093436,0.094963,0.096490,
;392:0.098017,0.099544,0.101070,0.102596,0.104122,0.105647,0.107172,0.108697,
;393:0.110222,0.111747,0.113271,0.114795,0.116319,0.117842,0.119365,0.120888,
;394:0.122411,0.123933,0.125455,0.126977,0.128498,0.130019,0.131540,0.133061,
;395:0.134581,0.136101,0.137620,0.139139,0.140658,0.142177,0.143695,0.145213,
;396:0.146730,0.148248,0.149765,0.151281,0.152797,0.154313,0.155828,0.157343,
;397:0.158858,0.160372,0.161886,0.163400,0.164913,0.166426,0.167938,0.169450,
;398:0.170962,0.172473,0.173984,0.175494,0.177004,0.178514,0.180023,0.181532,
;399:0.183040,0.184548,0.186055,0.187562,0.189069,0.190575,0.192080,0.193586,
;400:0.195090,0.196595,0.198098,0.199602,0.201105,0.202607,0.204109,0.205610,
;401:0.207111,0.208612,0.210112,0.211611,0.213110,0.214609,0.216107,0.217604,
;402:0.219101,0.220598,0.222094,0.223589,0.225084,0.226578,0.228072,0.229565,
;403:0.231058,0.232550,0.234042,0.235533,0.237024,0.238514,0.240003,0.241492,
;404:0.242980,0.244468,0.245955,0.247442,0.248928,0.250413,0.251898,0.253382,
;405:0.254866,0.256349,0.257831,0.259313,0.260794,0.262275,0.263755,0.265234,
;406:0.266713,0.268191,0.269668,0.271145,0.272621,0.274097,0.275572,0.277046,
;407:0.278520,0.279993,0.281465,0.282937,0.284408,0.285878,0.287347,0.288816,
;408:0.290285,0.291752,0.293219,0.294685,0.296151,0.297616,0.299080,0.300543,
;409:0.302006,0.303468,0.304929,0.306390,0.307850,0.309309,0.310767,0.312225,
;410:0.313682,0.315138,0.316593,0.318048,0.319502,0.320955,0.322408,0.323859,
;411:0.325310,0.326760,0.328210,0.329658,0.331106,0.332553,0.334000,0.335445,
;412:0.336890,0.338334,0.339777,0.341219,0.342661,0.344101,0.345541,0.346980,
;413:0.348419,0.349856,0.351293,0.352729,0.354164,0.355598,0.357031,0.358463,
;414:0.359895,0.361326,0.362756,0.364185,0.365613,0.367040,0.368467,0.369892,
;415:0.371317,0.372741,0.374164,0.375586,0.377007,0.378428,0.379847,0.381266,
;416:0.382683,0.384100,0.385516,0.386931,0.388345,0.389758,0.391170,0.392582,
;417:0.393992,0.395401,0.396810,0.398218,0.399624,0.401030,0.402435,0.403838,
;418:0.405241,0.406643,0.408044,0.409444,0.410843,0.412241,0.413638,0.415034,
;419:0.416430,0.417824,0.419217,0.420609,0.422000,0.423390,0.424780,0.426168,
;420:0.427555,0.428941,0.430326,0.431711,0.433094,0.434476,0.435857,0.437237,
;421:0.438616,0.439994,0.441371,0.442747,0.444122,0.445496,0.446869,0.448241,
;422:0.449611,0.450981,0.452350,0.453717,0.455084,0.456449,0.457813,0.459177,
;423:0.460539,0.461900,0.463260,0.464619,0.465976,0.467333,0.468689,0.470043,
;424:0.471397,0.472749,0.474100,0.475450,0.476799,0.478147,0.479494,0.480839,
;425:0.482184,0.483527,0.484869,0.486210,0.487550,0.488889,0.490226,0.491563,
;426:0.492898,0.494232,0.495565,0.496897,0.498228,0.499557,0.500885,0.502212,
;427:0.503538,0.504863,0.506187,0.507509,0.508830,0.510150,0.511469,0.512786,
;428:0.514103,0.515418,0.516732,0.518045,0.519356,0.520666,0.521975,0.523283,
;429:0.524590,0.525895,0.527199,0.528502,0.529804,0.531104,0.532403,0.533701,
;430:0.534998,0.536293,0.537587,0.538880,0.540171,0.541462,0.542751,0.544039,
;431:0.545325,0.546610,0.547894,0.549177,0.550458,0.551738,0.553017,0.554294,
;432:0.555570,0.556845,0.558119,0.559391,0.560662,0.561931,0.563199,0.564466,
;433:0.565732,0.566996,0.568259,0.569521,0.570781,0.572040,0.573297,0.574553,
;434:0.575808,0.577062,0.578314,0.579565,0.580814,0.582062,0.583309,0.584554,
;435:0.585798,0.587040,0.588282,0.589521,0.590760,0.591997,0.593232,0.594466,
;436:0.595699,0.596931,0.598161,0.599389,0.600616,0.601842,0.603067,0.604290,
;437:0.605511,0.606731,0.607950,0.609167,0.610383,0.611597,0.612810,0.614022,
;438:0.615232,0.616440,0.617647,0.618853,0.620057,0.621260,0.622461,0.623661,
;439:0.624859,0.626056,0.627252,0.628446,0.629638,0.630829,0.632019,0.633207,
;440:0.634393,0.635578,0.636762,0.637944,0.639124,0.640303,0.641481,0.642657,
;441:0.643832,0.645005,0.646176,0.647346,0.648514,0.649681,0.650847,0.652011,
;442:0.653173,0.654334,0.655493,0.656651,0.657807,0.658961,0.660114,0.661266,
;443:0.662416,0.663564,0.664711,0.665856,0.667000,0.668142,0.669283,0.670422,
;444:0.671559,0.672695,0.673829,0.674962,0.676093,0.677222,0.678350,0.679476,
;445:0.680601,0.681724,0.682846,0.683965,0.685084,0.686200,0.687315,0.688429,
;446:0.689541,0.690651,0.691759,0.692866,0.693971,0.695075,0.696177,0.697278,
;447:0.698376,0.699473,0.700569,0.701663,0.702755,0.703845,0.704934,0.706021,
;448:0.707107,0.708191,0.709273,0.710353,0.711432,0.712509,0.713585,0.714659,
;449:0.715731,0.716801,0.717870,0.718937,0.720003,0.721066,0.722128,0.723188,
;450:0.724247,0.725304,0.726359,0.727413,0.728464,0.729514,0.730563,0.731609,
;451:0.732654,0.733697,0.734739,0.735779,0.736817,0.737853,0.738887,0.739920,
;452:0.740951,0.741980,0.743008,0.744034,0.745058,0.746080,0.747101,0.748119,
;453:0.749136,0.750152,0.751165,0.752177,0.753187,0.754195,0.755201,0.756206,
;454:0.757209,0.758210,0.759209,0.760207,0.761202,0.762196,0.763188,0.764179,
;455:0.765167,0.766154,0.767139,0.768122,0.769103,0.770083,0.771061,0.772036,
;456:0.773010,0.773983,0.774953,0.775922,0.776888,0.777853,0.778817,0.779778,
;457:0.780737,0.781695,0.782651,0.783605,0.784557,0.785507,0.786455,0.787402,
;458:0.788346,0.789289,0.790230,0.791169,0.792107,0.793042,0.793975,0.794907,
;459:0.795837,0.796765,0.797691,0.798615,0.799537,0.800458,0.801376,0.802293,
;460:0.803208,0.804120,0.805031,0.805940,0.806848,0.807753,0.808656,0.809558,
;461:0.810457,0.811355,0.812251,0.813144,0.814036,0.814926,0.815814,0.816701,
;462:0.817585,0.818467,0.819348,0.820226,0.821103,0.821977,0.822850,0.823721,
;463:0.824589,0.825456,0.826321,0.827184,0.828045,0.828904,0.829761,0.830616,
;464:0.831470,0.832321,0.833170,0.834018,0.834863,0.835706,0.836548,0.837387,
;465:0.838225,0.839060,0.839894,0.840725,0.841555,0.842383,0.843208,0.844032,
;466:0.844854,0.845673,0.846491,0.847307,0.848120,0.848932,0.849742,0.850549,
;467:0.851355,0.852159,0.852961,0.853760,0.854558,0.855354,0.856147,0.856939,
;468:0.857729,0.858516,0.859302,0.860085,0.860867,0.861646,0.862424,0.863199,
;469:0.863973,0.864744,0.865514,0.866281,0.867046,0.867809,0.868571,0.869330,
;470:0.870087,0.870842,0.871595,0.872346,0.873095,0.873842,0.874587,0.875329,
;471:0.876070,0.876809,0.877545,0.878280,0.879012,0.879743,0.880471,0.881197,
;472:0.881921,0.882643,0.883363,0.884081,0.884797,0.885511,0.886223,0.886932,
;473:0.887640,0.888345,0.889048,0.889750,0.890449,0.891146,0.891841,0.892534,
;474:0.893224,0.893913,0.894599,0.895284,0.895966,0.896646,0.897325,0.898001,
;475:0.898674,0.899346,0.900016,0.900683,0.901349,0.902012,0.902673,0.903332,
;476:0.903989,0.904644,0.905297,0.905947,0.906596,0.907242,0.907886,0.908528,
;477:0.909168,0.909806,0.910441,0.911075,0.911706,0.912335,0.912962,0.913587,
;478:0.914210,0.914830,0.915449,0.916065,0.916679,0.917291,0.917901,0.918508,
;479:0.919114,0.919717,0.920318,0.920917,0.921514,0.922109,0.922701,0.923291,
;480:0.923880,0.924465,0.925049,0.925631,0.926210,0.926787,0.927363,0.927935,
;481:0.928506,0.929075,0.929641,0.930205,0.930767,0.931327,0.931884,0.932440,
;482:0.932993,0.933544,0.934093,0.934639,0.935184,0.935726,0.936266,0.936803,
;483:0.937339,0.937872,0.938404,0.938932,0.939459,0.939984,0.940506,0.941026,
;484:0.941544,0.942060,0.942573,0.943084,0.943593,0.944100,0.944605,0.945107,
;485:0.945607,0.946105,0.946601,0.947094,0.947586,0.948075,0.948561,0.949046,
;486:0.949528,0.950008,0.950486,0.950962,0.951435,0.951906,0.952375,0.952842,
;487:0.953306,0.953768,0.954228,0.954686,0.955141,0.955594,0.956045,0.956494,
;488:0.956940,0.957385,0.957826,0.958266,0.958703,0.959139,0.959572,0.960002,
;489:0.960431,0.960857,0.961280,0.961702,0.962121,0.962538,0.962953,0.963366,
;490:0.963776,0.964184,0.964590,0.964993,0.965394,0.965793,0.966190,0.966584,
;491:0.966976,0.967366,0.967754,0.968139,0.968522,0.968903,0.969281,0.969657,
;492:0.970031,0.970403,0.970772,0.971139,0.971504,0.971866,0.972226,0.972584,
;493:0.972940,0.973293,0.973644,0.973993,0.974339,0.974684,0.975025,0.975365,
;494:0.975702,0.976037,0.976370,0.976700,0.977028,0.977354,0.977677,0.977999,
;495:0.978317,0.978634,0.978948,0.979260,0.979570,0.979877,0.980182,0.980485,
;496:0.980785,0.981083,0.981379,0.981673,0.981964,0.982253,0.982539,0.982824,
;497:0.983105,0.983385,0.983662,0.983937,0.984210,0.984480,0.984749,0.985014,
;498:0.985278,0.985539,0.985798,0.986054,0.986308,0.986560,0.986809,0.987057,
;499:0.987301,0.987544,0.987784,0.988022,0.988258,0.988491,0.988722,0.988950,
;500:0.989177,0.989400,0.989622,0.989841,0.990058,0.990273,0.990485,0.990695,
;501:0.990903,0.991108,0.991311,0.991511,0.991710,0.991906,0.992099,0.992291,
;502:0.992480,0.992666,0.992850,0.993032,0.993212,0.993389,0.993564,0.993737,
;503:0.993907,0.994075,0.994240,0.994404,0.994565,0.994723,0.994879,0.995033,
;504:0.995185,0.995334,0.995481,0.995625,0.995767,0.995907,0.996045,0.996180,
;505:0.996313,0.996443,0.996571,0.996697,0.996820,0.996941,0.997060,0.997176,
;506:0.997290,0.997402,0.997511,0.997618,0.997723,0.997825,0.997925,0.998023,
;507:0.998118,0.998211,0.998302,0.998390,0.998476,0.998559,0.998640,0.998719,
;508:0.998795,0.998870,0.998941,0.999011,0.999078,0.999142,0.999205,0.999265,
;509:0.999322,0.999378,0.999431,0.999481,0.999529,0.999575,0.999619,0.999660,
;510:0.999699,0.999735,0.999769,0.999801,0.999831,0.999858,0.999882,0.999905,
;511:0.999925,0.999942,0.999958,0.999971,0.999981,0.999989,0.999995,0.999999
;512:};
;513:
;514:double sin( double x ) {
;515: int index;
;516: int quad;
;517:
;518: index = 1024 * x / (M_PI * 0.5);
;519: quad = ( index >> 10 ) & 3;
;520: index &= 1023;
;521: switch ( quad ) {
;522: case 0:
;523: return sintable[index];
;524: case 1:
;525: return sintable[1023-index];
;526: case 2:
;527: return -sintable[index];
;528: case 3:
;529: return -sintable[1023-index];
;530: }
;531: return 0;
;532:}
;533:
;534:
;535:double cos( double x ) {
;536: int index;
;537: int quad;
;538:
;539: index = 1024 * x / (M_PI * 0.5);
;540: quad = ( index >> 10 ) & 3;
;541: index &= 1023;
;542: switch ( quad ) {
;543: case 3:
;544: return sintable[index];
;545: case 0:
;546: return sintable[1023-index];
;547: case 1:
;548: return -sintable[index];
;549: case 2:
;550: return -sintable[1023-index];
;551: }
;552: return 0;
;553:}
;554:
;555:
;556:/*
;557:void create_acostable( void ) {
;558: int i;
;559: FILE *fp;
;560: float a;
;561:
;562: fp = fopen("c:\\acostable.txt", "w");
;563: fprintf(fp, "float acostable[] = {");
;564: for (i = 0; i < 1024; i++) {
;565: if (!(i & 7))
;566: fprintf(fp, "\n");
;567: a = acos( (float) -1 + i / 512 );
;568: fprintf(fp, "%1.8f,", a);
;569: }
;570: fprintf(fp, "\n}\n");
;571: fclose(fp);
;572:}
;573:*/
;574:
;575:float acostable[] = {
;576:3.14159265,3.07908248,3.05317551,3.03328655,3.01651113,3.00172442,2.98834964,2.97604422,
;577:2.96458497,2.95381690,2.94362719,2.93393068,2.92466119,2.91576615,2.90720289,2.89893629,
;578:2.89093699,2.88318015,2.87564455,2.86831188,2.86116621,2.85419358,2.84738169,2.84071962,
;579:2.83419760,2.82780691,2.82153967,2.81538876,2.80934770,2.80341062,2.79757211,2.79182724,
;580:2.78617145,2.78060056,2.77511069,2.76969824,2.76435988,2.75909250,2.75389319,2.74875926,
;581:2.74368816,2.73867752,2.73372510,2.72882880,2.72398665,2.71919677,2.71445741,2.70976688,
;582:2.70512362,2.70052613,2.69597298,2.69146283,2.68699438,2.68256642,2.67817778,2.67382735,
;583:2.66951407,2.66523692,2.66099493,2.65678719,2.65261279,2.64847088,2.64436066,2.64028133,
;584:2.63623214,2.63221238,2.62822133,2.62425835,2.62032277,2.61641398,2.61253138,2.60867440,
;585:2.60484248,2.60103507,2.59725167,2.59349176,2.58975488,2.58604053,2.58234828,2.57867769,
;586:2.57502832,2.57139977,2.56779164,2.56420354,2.56063509,2.55708594,2.55355572,2.55004409,
;587:2.54655073,2.54307530,2.53961750,2.53617701,2.53275354,2.52934680,2.52595650,2.52258238,
;588:2.51922417,2.51588159,2.51255441,2.50924238,2.50594525,2.50266278,2.49939476,2.49614096,
;589:2.49290115,2.48967513,2.48646269,2.48326362,2.48007773,2.47690482,2.47374472,2.47059722,
;590:2.46746215,2.46433933,2.46122860,2.45812977,2.45504269,2.45196720,2.44890314,2.44585034,
;591:2.44280867,2.43977797,2.43675809,2.43374890,2.43075025,2.42776201,2.42478404,2.42181622,
;592:2.41885841,2.41591048,2.41297232,2.41004380,2.40712480,2.40421521,2.40131491,2.39842379,
;593:2.39554173,2.39266863,2.38980439,2.38694889,2.38410204,2.38126374,2.37843388,2.37561237,
;594:2.37279910,2.36999400,2.36719697,2.36440790,2.36162673,2.35885335,2.35608768,2.35332964,
;595:2.35057914,2.34783610,2.34510044,2.34237208,2.33965094,2.33693695,2.33423003,2.33153010,
;596:2.32883709,2.32615093,2.32347155,2.32079888,2.31813284,2.31547337,2.31282041,2.31017388,
;597:2.30753373,2.30489988,2.30227228,2.29965086,2.29703556,2.29442632,2.29182309,2.28922580,
;598:2.28663439,2.28404881,2.28146900,2.27889490,2.27632647,2.27376364,2.27120637,2.26865460,
;599:2.26610827,2.26356735,2.26103177,2.25850149,2.25597646,2.25345663,2.25094195,2.24843238,
;600:2.24592786,2.24342836,2.24093382,2.23844420,2.23595946,2.23347956,2.23100444,2.22853408,
;601:2.22606842,2.22360742,2.22115104,2.21869925,2.21625199,2.21380924,2.21137096,2.20893709,
;602:2.20650761,2.20408248,2.20166166,2.19924511,2.19683280,2.19442469,2.19202074,2.18962092,
;603:2.18722520,2.18483354,2.18244590,2.18006225,2.17768257,2.17530680,2.17293493,2.17056692,
;604:2.16820274,2.16584236,2.16348574,2.16113285,2.15878367,2.15643816,2.15409630,2.15175805,
;605:2.14942338,2.14709226,2.14476468,2.14244059,2.14011997,2.13780279,2.13548903,2.13317865,
;606:2.13087163,2.12856795,2.12626757,2.12397047,2.12167662,2.11938600,2.11709859,2.11481435,
;607:2.11253326,2.11025530,2.10798044,2.10570867,2.10343994,2.10117424,2.09891156,2.09665185,
;608:2.09439510,2.09214129,2.08989040,2.08764239,2.08539725,2.08315496,2.08091550,2.07867884,
;609:2.07644495,2.07421383,2.07198545,2.06975978,2.06753681,2.06531651,2.06309887,2.06088387,
;610:2.05867147,2.05646168,2.05425445,2.05204979,2.04984765,2.04764804,2.04545092,2.04325628,
;611:2.04106409,2.03887435,2.03668703,2.03450211,2.03231957,2.03013941,2.02796159,2.02578610,
;612:2.02361292,2.02144204,2.01927344,2.01710710,2.01494300,2.01278113,2.01062146,2.00846399,
;613:2.00630870,2.00415556,2.00200457,1.99985570,1.99770895,1.99556429,1.99342171,1.99128119,
;614:1.98914271,1.98700627,1.98487185,1.98273942,1.98060898,1.97848051,1.97635399,1.97422942,
;615:1.97210676,1.96998602,1.96786718,1.96575021,1.96363511,1.96152187,1.95941046,1.95730088,
;616:1.95519310,1.95308712,1.95098292,1.94888050,1.94677982,1.94468089,1.94258368,1.94048818,
;617:1.93839439,1.93630228,1.93421185,1.93212308,1.93003595,1.92795046,1.92586659,1.92378433,
;618:1.92170367,1.91962459,1.91754708,1.91547113,1.91339673,1.91132385,1.90925250,1.90718266,
;619:1.90511432,1.90304746,1.90098208,1.89891815,1.89685568,1.89479464,1.89273503,1.89067683,
;620:1.88862003,1.88656463,1.88451060,1.88245794,1.88040664,1.87835668,1.87630806,1.87426076,
;621:1.87221477,1.87017008,1.86812668,1.86608457,1.86404371,1.86200412,1.85996577,1.85792866,
;622:1.85589277,1.85385809,1.85182462,1.84979234,1.84776125,1.84573132,1.84370256,1.84167495,
;623:1.83964848,1.83762314,1.83559892,1.83357582,1.83155381,1.82953289,1.82751305,1.82549429,
;624:1.82347658,1.82145993,1.81944431,1.81742973,1.81541617,1.81340362,1.81139207,1.80938151,
;625:1.80737194,1.80536334,1.80335570,1.80134902,1.79934328,1.79733848,1.79533460,1.79333164,
;626:1.79132959,1.78932843,1.78732817,1.78532878,1.78333027,1.78133261,1.77933581,1.77733985,
;627:1.77534473,1.77335043,1.77135695,1.76936428,1.76737240,1.76538132,1.76339101,1.76140148,
;628:1.75941271,1.75742470,1.75543743,1.75345090,1.75146510,1.74948002,1.74749565,1.74551198,
;629:1.74352900,1.74154672,1.73956511,1.73758417,1.73560389,1.73362426,1.73164527,1.72966692,
;630:1.72768920,1.72571209,1.72373560,1.72175971,1.71978441,1.71780969,1.71583556,1.71386199,
;631:1.71188899,1.70991653,1.70794462,1.70597325,1.70400241,1.70203209,1.70006228,1.69809297,
;632:1.69612416,1.69415584,1.69218799,1.69022062,1.68825372,1.68628727,1.68432127,1.68235571,
;633:1.68039058,1.67842588,1.67646160,1.67449772,1.67253424,1.67057116,1.66860847,1.66664615,
;634:1.66468420,1.66272262,1.66076139,1.65880050,1.65683996,1.65487975,1.65291986,1.65096028,
;635:1.64900102,1.64704205,1.64508338,1.64312500,1.64116689,1.63920905,1.63725148,1.63529416,
;636:1.63333709,1.63138026,1.62942366,1.62746728,1.62551112,1.62355517,1.62159943,1.61964388,
;637:1.61768851,1.61573332,1.61377831,1.61182346,1.60986877,1.60791422,1.60595982,1.60400556,
;638:1.60205142,1.60009739,1.59814349,1.59618968,1.59423597,1.59228235,1.59032882,1.58837536,
;639:1.58642196,1.58446863,1.58251535,1.58056211,1.57860891,1.57665574,1.57470259,1.57274945,
;640:1.57079633,1.56884320,1.56689007,1.56493692,1.56298375,1.56103055,1.55907731,1.55712403,
;641:1.55517069,1.55321730,1.55126383,1.54931030,1.54735668,1.54540297,1.54344917,1.54149526,
;642:1.53954124,1.53758710,1.53563283,1.53367843,1.53172389,1.52976919,1.52781434,1.52585933,
;643:1.52390414,1.52194878,1.51999323,1.51803748,1.51608153,1.51412537,1.51216900,1.51021240,
;644:1.50825556,1.50629849,1.50434117,1.50238360,1.50042576,1.49846765,1.49650927,1.49455060,
;645:1.49259163,1.49063237,1.48867280,1.48671291,1.48475270,1.48279215,1.48083127,1.47887004,
;646:1.47690845,1.47494650,1.47298419,1.47102149,1.46905841,1.46709493,1.46513106,1.46316677,
;647:1.46120207,1.45923694,1.45727138,1.45530538,1.45333893,1.45137203,1.44940466,1.44743682,
;648:1.44546850,1.44349969,1.44153038,1.43956057,1.43759024,1.43561940,1.43364803,1.43167612,
;649:1.42970367,1.42773066,1.42575709,1.42378296,1.42180825,1.41983295,1.41785705,1.41588056,
;650:1.41390346,1.41192573,1.40994738,1.40796840,1.40598877,1.40400849,1.40202755,1.40004594,
;651:1.39806365,1.39608068,1.39409701,1.39211264,1.39012756,1.38814175,1.38615522,1.38416795,
;652:1.38217994,1.38019117,1.37820164,1.37621134,1.37422025,1.37222837,1.37023570,1.36824222,
;653:1.36624792,1.36425280,1.36225684,1.36026004,1.35826239,1.35626387,1.35426449,1.35226422,
;654:1.35026307,1.34826101,1.34625805,1.34425418,1.34224937,1.34024364,1.33823695,1.33622932,
;655:1.33422072,1.33221114,1.33020059,1.32818904,1.32617649,1.32416292,1.32214834,1.32013273,
;656:1.31811607,1.31609837,1.31407960,1.31205976,1.31003885,1.30801684,1.30599373,1.30396951,
;657:1.30194417,1.29991770,1.29789009,1.29586133,1.29383141,1.29180031,1.28976803,1.28773456,
;658:1.28569989,1.28366400,1.28162688,1.27958854,1.27754894,1.27550809,1.27346597,1.27142257,
;659:1.26937788,1.26733189,1.26528459,1.26323597,1.26118602,1.25913471,1.25708205,1.25502803,
;660:1.25297262,1.25091583,1.24885763,1.24679802,1.24473698,1.24267450,1.24061058,1.23854519,
;661:1.23647833,1.23440999,1.23234015,1.23026880,1.22819593,1.22612152,1.22404557,1.22196806,
;662:1.21988898,1.21780832,1.21572606,1.21364219,1.21155670,1.20946958,1.20738080,1.20529037,
;663:1.20319826,1.20110447,1.19900898,1.19691177,1.19481283,1.19271216,1.19060973,1.18850553,
;664:1.18639955,1.18429178,1.18218219,1.18007079,1.17795754,1.17584244,1.17372548,1.17160663,
;665:1.16948589,1.16736324,1.16523866,1.16311215,1.16098368,1.15885323,1.15672081,1.15458638,
;666:1.15244994,1.15031147,1.14817095,1.14602836,1.14388370,1.14173695,1.13958808,1.13743709,
;667:1.13528396,1.13312866,1.13097119,1.12881153,1.12664966,1.12448556,1.12231921,1.12015061,
;668:1.11797973,1.11580656,1.11363107,1.11145325,1.10927308,1.10709055,1.10490563,1.10271831,
;669:1.10052856,1.09833638,1.09614174,1.09394462,1.09174500,1.08954287,1.08733820,1.08513098,
;670:1.08292118,1.08070879,1.07849378,1.07627614,1.07405585,1.07183287,1.06960721,1.06737882,
;671:1.06514770,1.06291382,1.06067715,1.05843769,1.05619540,1.05395026,1.05170226,1.04945136,
;672:1.04719755,1.04494080,1.04268110,1.04041841,1.03815271,1.03588399,1.03361221,1.03133735,
;673:1.02905939,1.02677830,1.02449407,1.02220665,1.01991603,1.01762219,1.01532509,1.01302471,
;674:1.01072102,1.00841400,1.00610363,1.00378986,1.00147268,0.99915206,0.99682798,0.99450039,
;675:0.99216928,0.98983461,0.98749636,0.98515449,0.98280898,0.98045980,0.97810691,0.97575030,
;676:0.97338991,0.97102573,0.96865772,0.96628585,0.96391009,0.96153040,0.95914675,0.95675912,
;677:0.95436745,0.95197173,0.94957191,0.94716796,0.94475985,0.94234754,0.93993099,0.93751017,
;678:0.93508504,0.93265556,0.93022170,0.92778341,0.92534066,0.92289341,0.92044161,0.91798524,
;679:0.91552424,0.91305858,0.91058821,0.90811309,0.90563319,0.90314845,0.90065884,0.89816430,
;680:0.89566479,0.89316028,0.89065070,0.88813602,0.88561619,0.88309116,0.88056088,0.87802531,
;681:0.87548438,0.87293806,0.87038629,0.86782901,0.86526619,0.86269775,0.86012366,0.85754385,
;682:0.85495827,0.85236686,0.84976956,0.84716633,0.84455709,0.84194179,0.83932037,0.83669277,
;683:0.83405893,0.83141877,0.82877225,0.82611928,0.82345981,0.82079378,0.81812110,0.81544172,
;684:0.81275556,0.81006255,0.80736262,0.80465570,0.80194171,0.79922057,0.79649221,0.79375655,
;685:0.79101352,0.78826302,0.78550497,0.78273931,0.77996593,0.77718475,0.77439569,0.77159865,
;686:0.76879355,0.76598029,0.76315878,0.76032891,0.75749061,0.75464376,0.75178826,0.74892402,
;687:0.74605092,0.74316887,0.74027775,0.73737744,0.73446785,0.73154885,0.72862033,0.72568217,
;688:0.72273425,0.71977644,0.71680861,0.71383064,0.71084240,0.70784376,0.70483456,0.70181469,
;689:0.69878398,0.69574231,0.69268952,0.68962545,0.68654996,0.68346288,0.68036406,0.67725332,
;690:0.67413051,0.67099544,0.66784794,0.66468783,0.66151492,0.65832903,0.65512997,0.65191753,
;691:0.64869151,0.64545170,0.64219789,0.63892987,0.63564741,0.63235028,0.62903824,0.62571106,
;692:0.62236849,0.61901027,0.61563615,0.61224585,0.60883911,0.60541564,0.60197515,0.59851735,
;693:0.59504192,0.59154856,0.58803694,0.58450672,0.58095756,0.57738911,0.57380101,0.57019288,
;694:0.56656433,0.56291496,0.55924437,0.55555212,0.55183778,0.54810089,0.54434099,0.54055758,
;695:0.53675018,0.53291825,0.52906127,0.52517867,0.52126988,0.51733431,0.51337132,0.50938028,
;696:0.50536051,0.50131132,0.49723200,0.49312177,0.48897987,0.48480547,0.48059772,0.47635573,
;697:0.47207859,0.46776530,0.46341487,0.45902623,0.45459827,0.45012983,0.44561967,0.44106652,
;698:0.43646903,0.43182577,0.42713525,0.42239588,0.41760600,0.41276385,0.40786755,0.40291513,
;699:0.39790449,0.39283339,0.38769946,0.38250016,0.37723277,0.37189441,0.36648196,0.36099209,
;700:0.35542120,0.34976542,0.34402054,0.33818204,0.33224495,0.32620390,0.32005298,0.31378574,
;701:0.30739505,0.30087304,0.29421096,0.28739907,0.28042645,0.27328078,0.26594810,0.25841250,
;702:0.25065566,0.24265636,0.23438976,0.22582651,0.21693146,0.20766198,0.19796546,0.18777575,
;703:0.17700769,0.16554844,0.15324301,0.13986823,0.12508152,0.10830610,0.08841715,0.06251018,
;704:}
;705:
;706:double acos( double x ) {
;707: int index;
;708:
;709: if (x < -1)
;710: x = -1;
;711: if (x > 1)
;712: x = 1;
;713: index = (float) (1.0 + x) * 511.9;
;714: return acostable[index];
;715:}
;716:
;717:double atan2( double y, double x ) {
;718: float base;
;719: float temp;
;720: float dir;
;721: float test;
;722: int i;
;723:
;724: if ( x < 0 ) {
;725: if ( y >= 0 ) {
;726: // quad 1
;727: base = M_PI / 2;
;728: temp = x;
;729: x = y;
;730: y = -temp;
;731: } else {
;732: // quad 2
;733: base = M_PI;
;734: x = -x;
;735: y = -y;
;736: }
;737: } else {
;738: if ( y < 0 ) {
;739: // quad 3
;740: base = 3 * M_PI / 2;
;741: temp = x;
;742: x = -y;
;743: y = temp;
;744: }
;745: }
;746:
;747: if ( y > x ) {
;748: base += M_PI/2;
;749: temp = x;
;750: x = y;
;751: y = temp;
;752: dir = -1;
;753: } else {
;754: dir = 1;
;755: }
;756:
;757: // calcualte angle in octant 0
;758: if ( x == 0 ) {
;759: return base;
;760: }
;761: y /= x;
;762:
;763: for ( i = 0 ; i < 512 ; i++ ) {
;764: test = sintable[i] / sintable[1023-i];
;765: if ( test > y ) {
;766: break;
;767: }
;768: }
;769:
;770: return base + dir * i * ( M_PI/2048);
;771:}
;772:
;773:
;774:#endif
;775:
;776:#ifdef Q3_VM
;777:// bk001127 - guarded this tan replacement
;778:// ld: undefined versioned symbol name tan@@GLIBC_2.0
;779:double tan( double x ) {
line 780
;780: return sin(x) / cos(x);
ADDRFP4 0
INDIRF4
ARGF4
ADDRLP4 0
ADDRGP4 sin
CALLF4
ASGNF4
ADDRFP4 0
INDIRF4
ARGF4
ADDRLP4 4
ADDRGP4 cos
CALLF4
ASGNF4
ADDRLP4 0
INDIRF4
ADDRLP4 4
INDIRF4
DIVF4
RETF4
LABELV $182
endproc tan 8 4
data
align 4
LABELV randSeed
byte 4 0
export srand
code
proc srand 0 0
line 787
;781:}
;782:#endif
;783:
;784:
;785:static int randSeed = 0;
;786:
;787:void srand( unsigned seed ) {
line 788
;788: randSeed = seed;
ADDRGP4 randSeed
ADDRFP4 0
INDIRU4
CVUI4 4
ASGNI4
line 789
;789:}
LABELV $183
endproc srand 0 0
export rand
proc rand 4 0
line 791
;790:
;791:int rand( void ) {
line 792
;792: randSeed = (69069 * randSeed + 1);
ADDRLP4 0
ADDRGP4 randSeed
ASGNP4
ADDRLP4 0
INDIRP4
CNSTI4 69069
ADDRLP4 0
INDIRP4
INDIRI4
MULI4
CNSTI4 1
ADDI4
ASGNI4
line 793
;793: return randSeed & 0x7fff;
ADDRGP4 randSeed
INDIRI4
CNSTI4 32767
BANDI4
RETI4
LABELV $184
endproc rand 4 0
export atof
proc atof 32 0
line 796
;794:}
;795:
;796:double atof( const char *string ) {
ADDRGP4 $187
JUMPV
LABELV $186
line 803
;797: float sign;
;798: float value;
;799: int c;
;800:
;801:
;802: // skip whitespace
;803: while ( *string <= ' ' ) {
line 804
;804: if ( !*string ) {
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $189
line 805
;805: return 0;
CNSTF4 0
RETF4
ADDRGP4 $185
JUMPV
LABELV $189
line 807
;806: }
;807: string++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 808
;808: }
LABELV $187
line 803
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
CNSTI4 32
LEI4 $186
line 811
;809:
;810: // check sign
;811: switch ( *string ) {
ADDRLP4 12
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 43
EQI4 $194
ADDRLP4 12
INDIRI4
CNSTI4 45
EQI4 $195
ADDRGP4 $191
JUMPV
LABELV $194
line 813
;812: case '+':
;813: string++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 814
;814: sign = 1;
ADDRLP4 8
CNSTF4 1065353216
ASGNF4
line 815
;815: break;
ADDRGP4 $192
JUMPV
LABELV $195
line 817
;816: case '-':
;817: string++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 818
;818: sign = -1;
ADDRLP4 8
CNSTF4 3212836864
ASGNF4
line 819
;819: break;
ADDRGP4 $192
JUMPV
LABELV $191
line 821
;820: default:
;821: sign = 1;
ADDRLP4 8
CNSTF4 1065353216
ASGNF4
line 822
;822: break;
LABELV $192
line 826
;823: }
;824:
;825: // read digits
;826: value = 0;
ADDRLP4 4
CNSTF4 0
ASGNF4
line 827
;827: c = string[0];
ADDRLP4 0
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
ASGNI4
line 828
;828: if ( c != '.' ) {
ADDRLP4 0
INDIRI4
CNSTI4 46
EQI4 $196
LABELV $198
line 829
;829: do {
line 830
;830: c = *string++;
ADDRLP4 20
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 0
ADDRLP4 20
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 0
ADDRLP4 20
INDIRP4
INDIRI1
CVII4 1
ASGNI4
line 831
;831: if ( c < '0' || c > '9' ) {
ADDRLP4 0
INDIRI4
CNSTI4 48
LTI4 $203
ADDRLP4 0
INDIRI4
CNSTI4 57
LEI4 $201
LABELV $203
line 832
;832: break;
ADDRGP4 $197
JUMPV
LABELV $201
line 834
;833: }
;834: c -= '0';
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 48
SUBI4
ASGNI4
line 835
;835: value = value * 10 + c;
ADDRLP4 4
CNSTF4 1092616192
ADDRLP4 4
INDIRF4
MULF4
ADDRLP4 0
INDIRI4
CVIF4 4
ADDF4
ASGNF4
line 836
;836: } while ( 1 );
LABELV $199
ADDRGP4 $198
JUMPV
line 837
;837: } else {
ADDRGP4 $197
JUMPV
LABELV $196
line 838
;838: string++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 839
;839: }
LABELV $197
line 842
;840:
;841: // check for decimal point
;842: if ( c == '.' ) {
ADDRLP4 0
INDIRI4
CNSTI4 46
NEI4 $204
line 845
;843: double fraction;
;844:
;845: fraction = 0.1;
ADDRLP4 20
CNSTF4 1036831949
ASGNF4
LABELV $206
line 846
;846: do {
line 847
;847: c = *string++;
ADDRLP4 24
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 0
ADDRLP4 24
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 0
ADDRLP4 24
INDIRP4
INDIRI1
CVII4 1
ASGNI4
line 848
;848: if ( c < '0' || c > '9' ) {
ADDRLP4 0
INDIRI4
CNSTI4 48
LTI4 $211
ADDRLP4 0
INDIRI4
CNSTI4 57
LEI4 $209
LABELV $211
line 849
;849: break;
ADDRGP4 $208
JUMPV
LABELV $209
line 851
;850: }
;851: c -= '0';
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 48
SUBI4
ASGNI4
line 852
;852: value += c * fraction;
ADDRLP4 4
ADDRLP4 4
INDIRF4
ADDRLP4 0
INDIRI4
CVIF4 4
ADDRLP4 20
INDIRF4
MULF4
ADDF4
ASGNF4
line 853
;853: fraction *= 0.1;
ADDRLP4 20
CNSTF4 1036831949
ADDRLP4 20
INDIRF4
MULF4
ASGNF4
line 854
;854: } while ( 1 );
LABELV $207
ADDRGP4 $206
JUMPV
LABELV $208
line 856
;855:
;856: }
LABELV $204
line 860
;857:
;858: // not handling 10e10 notation...
;859:
;860: return value * sign;
ADDRLP4 4
INDIRF4
ADDRLP4 8
INDIRF4
MULF4
RETF4
LABELV $185
endproc atof 32 0
export _atof
proc _atof 36 0
line 863
;861:}
;862:
;863:double _atof( const char **stringPtr ) {
line 867
;864: const char *string;
;865: float sign;
;866: float value;
;867: int c = '0'; // bk001211 - uninitialized use possible
ADDRLP4 0
CNSTI4 48
ASGNI4
line 869
;868:
;869: string = *stringPtr;
ADDRLP4 4
ADDRFP4 0
INDIRP4
INDIRP4
ASGNP4
ADDRGP4 $214
JUMPV
LABELV $213
line 872
;870:
;871: // skip whitespace
;872: while ( *string <= ' ' ) {
line 873
;873: if ( !*string ) {
ADDRLP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $216
line 874
;874: *stringPtr = string;
ADDRFP4 0
INDIRP4
ADDRLP4 4
INDIRP4
ASGNP4
line 875
;875: return 0;
CNSTF4 0
RETF4
ADDRGP4 $212
JUMPV
LABELV $216
line 877
;876: }
;877: string++;
ADDRLP4 4
ADDRLP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 878
;878: }
LABELV $214
line 872
ADDRLP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 32
LEI4 $213
line 881
;879:
;880: // check sign
;881: switch ( *string ) {
ADDRLP4 16
ADDRLP4 4
INDIRP4
INDIRI1
CVII4 1
ASGNI4
ADDRLP4 16
INDIRI4
CNSTI4 43
EQI4 $221
ADDRLP4 16
INDIRI4
CNSTI4 45
EQI4 $222
ADDRGP4 $218
JUMPV
LABELV $221
line 883
;882: case '+':
;883: string++;
ADDRLP4 4
ADDRLP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 884
;884: sign = 1;
ADDRLP4 12
CNSTF4 1065353216
ASGNF4
line 885
;885: break;
ADDRGP4 $219
JUMPV
LABELV $222
line 887
;886: case '-':
;887: string++;
ADDRLP4 4
ADDRLP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 888
;888: sign = -1;
ADDRLP4 12
CNSTF4 3212836864
ASGNF4
line 889
;889: break;
ADDRGP4 $219
JUMPV
LABELV $218
line 891
;890: default:
;891: sign = 1;
ADDRLP4 12
CNSTF4 1065353216
ASGNF4
line 892
;892: break;
LABELV $219
line 896
;893: }
;894:
;895: // read digits
;896: value = 0;
ADDRLP4 8
CNSTF4 0
ASGNF4
line 897
;897: if ( string[0] != '.' ) {
ADDRLP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 46
EQI4 $223
LABELV $225
line 898
;898: do {
line 899
;899: c = *string++;
ADDRLP4 24
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 24
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 0
ADDRLP4 24
INDIRP4
INDIRI1
CVII4 1
ASGNI4
line 900
;900: if ( c < '0' || c > '9' ) {
ADDRLP4 0
INDIRI4
CNSTI4 48
LTI4 $230
ADDRLP4 0
INDIRI4
CNSTI4 57
LEI4 $228
LABELV $230
line 901
;901: break;
ADDRGP4 $227
JUMPV
LABELV $228
line 903
;902: }
;903: c -= '0';
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 48
SUBI4
ASGNI4
line 904
;904: value = value * 10 + c;
ADDRLP4 8
CNSTF4 1092616192
ADDRLP4 8
INDIRF4
MULF4
ADDRLP4 0
INDIRI4
CVIF4 4
ADDF4
ASGNF4
line 905
;905: } while ( 1 );
LABELV $226
ADDRGP4 $225
JUMPV
LABELV $227
line 906
;906: }
LABELV $223
line 909
;907:
;908: // check for decimal point
;909: if ( c == '.' ) {
ADDRLP4 0
INDIRI4
CNSTI4 46
NEI4 $231
line 912
;910: double fraction;
;911:
;912: fraction = 0.1;
ADDRLP4 24
CNSTF4 1036831949
ASGNF4
LABELV $233
line 913
;913: do {
line 914
;914: c = *string++;
ADDRLP4 28
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 28
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 0
ADDRLP4 28
INDIRP4
INDIRI1
CVII4 1
ASGNI4
line 915
;915: if ( c < '0' || c > '9' ) {
ADDRLP4 0
INDIRI4
CNSTI4 48
LTI4 $238
ADDRLP4 0
INDIRI4
CNSTI4 57
LEI4 $236
LABELV $238
line 916
;916: break;
ADDRGP4 $235
JUMPV
LABELV $236
line 918
;917: }
;918: c -= '0';
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 48
SUBI4
ASGNI4
line 919
;919: value += c * fraction;
ADDRLP4 8
ADDRLP4 8
INDIRF4
ADDRLP4 0
INDIRI4
CVIF4 4
ADDRLP4 24
INDIRF4
MULF4
ADDF4
ASGNF4
line 920
;920: fraction *= 0.1;
ADDRLP4 24
CNSTF4 1036831949
ADDRLP4 24
INDIRF4
MULF4
ASGNF4
line 921
;921: } while ( 1 );
LABELV $234
ADDRGP4 $233
JUMPV
LABELV $235
line 923
;922:
;923: }
LABELV $231
line 926
;924:
;925: // not handling 10e10 notation...
;926: *stringPtr = string;
ADDRFP4 0
INDIRP4
ADDRLP4 4
INDIRP4
ASGNP4
line 928
;927:
;928: return value * sign;
ADDRLP4 8
INDIRF4
ADDRLP4 12
INDIRF4
MULF4
RETF4
LABELV $212
endproc _atof 36 0
export atoi
proc atoi 28 0
line 937
;929:}
;930:
;931:
;932:// bk001120 - presumably needed for Mac
;933://#if !defined ( _MSC_VER ) && ! defined ( __linux__ )
;934:
;935:// bk001127 - undid undo
;936:#if defined ( Q3_VM )
;937:int atoi( const char *string ) {
ADDRGP4 $241
JUMPV
LABELV $240
line 944
;938: int sign;
;939: int value;
;940: int c;
;941:
;942:
;943: // skip whitespace
;944: while ( *string <= ' ' ) {
line 945
;945: if ( !*string ) {
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $243
line 946
;946: return 0;
CNSTI4 0
RETI4
ADDRGP4 $239
JUMPV
LABELV $243
line 948
;947: }
;948: string++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 949
;949: }
LABELV $241
line 944
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
CNSTI4 32
LEI4 $240
line 952
;950:
;951: // check sign
;952: switch ( *string ) {
ADDRLP4 12
ADDRFP4 0
INDIRP4
INDIRI1
CVII4 1
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 43
EQI4 $248
ADDRLP4 12
INDIRI4
CNSTI4 45
EQI4 $249
ADDRGP4 $245
JUMPV
LABELV $248
line 954
;953: case '+':
;954: string++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 955
;955: sign = 1;
ADDRLP4 8
CNSTI4 1
ASGNI4
line 956
;956: break;
ADDRGP4 $246
JUMPV
LABELV $249
line 958
;957: case '-':
;958: string++;
ADDRFP4 0
ADDRFP4 0
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 959
;959: sign = -1;
ADDRLP4 8
CNSTI4 -1
ASGNI4
line 960
;960: break;
ADDRGP4 $246
JUMPV
LABELV $245
line 962
;961: default:
;962: sign = 1;
ADDRLP4 8
CNSTI4 1
ASGNI4
line 963
;963: break;
LABELV $246
line 967
;964: }
;965:
;966: // read digits
;967: value = 0;
ADDRLP4 4
CNSTI4 0
ASGNI4
LABELV $250
line 968
;968: do {
line 969
;969: c = *string++;
ADDRLP4 20
ADDRFP4 0
INDIRP4
ASGNP4
ADDRFP4 0
ADDRLP4 20
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 0
ADDRLP4 20
INDIRP4
INDIRI1
CVII4 1
ASGNI4
line 970
;970: if ( c < '0' || c > '9' ) {
ADDRLP4 0
INDIRI4
CNSTI4 48
LTI4 $255
ADDRLP4 0
INDIRI4
CNSTI4 57
LEI4 $253
LABELV $255
line 971
;971: break;
ADDRGP4 $252
JUMPV
LABELV $253
line 973
;972: }
;973: c -= '0';
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 48
SUBI4
ASGNI4
line 974
;974: value = value * 10 + c;
ADDRLP4 4
CNSTI4 10
ADDRLP4 4
INDIRI4
MULI4
ADDRLP4 0
INDIRI4
ADDI4
ASGNI4
line 975
;975: } while ( 1 );
LABELV $251
ADDRGP4 $250
JUMPV
LABELV $252
line 979
;976:
;977: // not handling 10e10 notation...
;978:
;979: return value * sign;
ADDRLP4 4
INDIRI4
ADDRLP4 8
INDIRI4
MULI4
RETI4
LABELV $239
endproc atoi 28 0
export _atoi
proc _atoi 32 0
line 983
;980:}
;981:
;982:
;983:int _atoi( const char **stringPtr ) {
line 989
;984: int sign;
;985: int value;
;986: int c;
;987: const char *string;
;988:
;989: string = *stringPtr;
ADDRLP4 4
ADDRFP4 0
INDIRP4
INDIRP4
ASGNP4
ADDRGP4 $258
JUMPV
LABELV $257
line 992
;990:
;991: // skip whitespace
;992: while ( *string <= ' ' ) {
line 993
;993: if ( !*string ) {
ADDRLP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $260
line 994
;994: return 0;
CNSTI4 0
RETI4
ADDRGP4 $256
JUMPV
LABELV $260
line 996
;995: }
;996: string++;
ADDRLP4 4
ADDRLP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 997
;997: }
LABELV $258
line 992
ADDRLP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 32
LEI4 $257
line 1000
;998:
;999: // check sign
;1000: switch ( *string ) {
ADDRLP4 16
ADDRLP4 4
INDIRP4
INDIRI1
CVII4 1
ASGNI4
ADDRLP4 16
INDIRI4
CNSTI4 43
EQI4 $265
ADDRLP4 16
INDIRI4
CNSTI4 45
EQI4 $266
ADDRGP4 $262
JUMPV
LABELV $265
line 1002
;1001: case '+':
;1002: string++;
ADDRLP4 4
ADDRLP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 1003
;1003: sign = 1;
ADDRLP4 12
CNSTI4 1
ASGNI4
line 1004
;1004: break;
ADDRGP4 $263
JUMPV
LABELV $266
line 1006
;1005: case '-':
;1006: string++;
ADDRLP4 4
ADDRLP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 1007
;1007: sign = -1;
ADDRLP4 12
CNSTI4 -1
ASGNI4
line 1008
;1008: break;
ADDRGP4 $263
JUMPV
LABELV $262
line 1010
;1009: default:
;1010: sign = 1;
ADDRLP4 12
CNSTI4 1
ASGNI4
line 1011
;1011: break;
LABELV $263
line 1015
;1012: }
;1013:
;1014: // read digits
;1015: value = 0;
ADDRLP4 8
CNSTI4 0
ASGNI4
LABELV $267
line 1016
;1016: do {
line 1017
;1017: c = *string++;
ADDRLP4 24
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 24
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 0
ADDRLP4 24
INDIRP4
INDIRI1
CVII4 1
ASGNI4
line 1018
;1018: if ( c < '0' || c > '9' ) {
ADDRLP4 0
INDIRI4
CNSTI4 48
LTI4 $272
ADDRLP4 0
INDIRI4
CNSTI4 57
LEI4 $270
LABELV $272
line 1019
;1019: break;
ADDRGP4 $269
JUMPV
LABELV $270
line 1021
;1020: }
;1021: c -= '0';
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 48
SUBI4
ASGNI4
line 1022
;1022: value = value * 10 + c;
ADDRLP4 8
CNSTI4 10
ADDRLP4 8
INDIRI4
MULI4
ADDRLP4 0
INDIRI4
ADDI4
ASGNI4
line 1023
;1023: } while ( 1 );
LABELV $268
ADDRGP4 $267
JUMPV
LABELV $269
line 1027
;1024:
;1025: // not handling 10e10 notation...
;1026:
;1027: *stringPtr = string;
ADDRFP4 0
INDIRP4
ADDRLP4 4
INDIRP4
ASGNP4
line 1029
;1028:
;1029: return value * sign;
ADDRLP4 8
INDIRI4
ADDRLP4 12
INDIRI4
MULI4
RETI4
LABELV $256
endproc _atoi 32 0
export abs
proc abs 4 0
line 1032
;1030:}
;1031:
;1032:int abs( int n ) {
line 1033
;1033: return n < 0 ? -n : n;
ADDRFP4 0
INDIRI4
CNSTI4 0
GEI4 $275
ADDRLP4 0
ADDRFP4 0
INDIRI4
NEGI4
ASGNI4
ADDRGP4 $276
JUMPV
LABELV $275
ADDRLP4 0
ADDRFP4 0
INDIRI4
ASGNI4
LABELV $276
ADDRLP4 0
INDIRI4
RETI4
LABELV $273
endproc abs 4 0
export fabs
proc fabs 4 0
line 1036
;1034:}
;1035:
;1036:double fabs( double x ) {
line 1037
;1037: return x < 0 ? -x : x;
ADDRFP4 0
INDIRF4
CNSTF4 0
GEF4 $279
ADDRLP4 0
ADDRFP4 0
INDIRF4
NEGF4
ASGNF4
ADDRGP4 $280
JUMPV
LABELV $279
ADDRLP4 0
ADDRFP4 0
INDIRF4
ASGNF4
LABELV $280
ADDRLP4 0
INDIRF4
RETF4
LABELV $277
endproc fabs 4 0
export AddInt
proc AddInt 56 0
line 1059
;1038:}
;1039:
;1040:
;1041:
;1042://=========================================================
;1043:
;1044:
;1045:#define ALT 0x00000001 /* alternate form */
;1046:#define HEXPREFIX 0x00000002 /* add 0x or 0X prefix */
;1047:#define LADJUST 0x00000004 /* left adjustment */
;1048:#define LONGDBL 0x00000008 /* long double */
;1049:#define LONGINT 0x00000010 /* long integer */
;1050:#define QUADINT 0x00000020 /* quad integer */
;1051:#define SHORTINT 0x00000040 /* short integer */
;1052:#define ZEROPAD 0x00000080 /* zero (as opposed to blank) pad */
;1053:#define FPT 0x00000100 /* floating point number */
;1054:
;1055:#define to_digit(c) ((c) - '0')
;1056:#define is_digit(c) ((unsigned)to_digit(c) <= 9)
;1057:#define to_char(n) ((n) + '0')
;1058:
;1059:void AddInt( char **buf_p, int val, int width, int flags ) {
line 1065
;1060: char text[32];
;1061: int digits;
;1062: int signedVal;
;1063: char *buf;
;1064:
;1065: digits = 0;
ADDRLP4 0
CNSTI4 0
ASGNI4
line 1066
;1066: signedVal = val;
ADDRLP4 40
ADDRFP4 4
INDIRI4
ASGNI4
line 1067
;1067: if ( val < 0 ) {
ADDRFP4 4
INDIRI4
CNSTI4 0
GEI4 $282
line 1068
;1068: val = -val;
ADDRFP4 4
ADDRFP4 4
INDIRI4
NEGI4
ASGNI4
line 1069
;1069: }
LABELV $282
LABELV $284
line 1070
;1070: do {
line 1071
;1071: text[digits++] = '0' + val % 10;
ADDRLP4 44
ADDRLP4 0
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 44
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 44
INDIRI4
ADDRLP4 8
ADDP4
ADDRFP4 4
INDIRI4
CNSTI4 10
MODI4
CNSTI4 48
ADDI4
CVII1 4
ASGNI1
line 1072
;1072: val /= 10;
ADDRFP4 4
ADDRFP4 4
INDIRI4
CNSTI4 10
DIVI4
ASGNI4
line 1073
;1073: } while ( val );
LABELV $285
ADDRFP4 4
INDIRI4
CNSTI4 0
NEI4 $284
line 1075
;1074:
;1075: if ( signedVal < 0 ) {
ADDRLP4 40
INDIRI4
CNSTI4 0
GEI4 $287
line 1076
;1076: text[digits++] = '-';
ADDRLP4 44
ADDRLP4 0
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 44
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 44
INDIRI4
ADDRLP4 8
ADDP4
CNSTI1 45
ASGNI1
line 1077
;1077: }
LABELV $287
line 1079
;1078:
;1079: buf = *buf_p;
ADDRLP4 4
ADDRFP4 0
INDIRP4
INDIRP4
ASGNP4
line 1081
;1080:
;1081: if( !( flags & LADJUST ) ) {
ADDRFP4 12
INDIRI4
CNSTI4 4
BANDI4
CNSTI4 0
NEI4 $298
ADDRGP4 $292
JUMPV
LABELV $291
line 1082
;1082: while ( digits < width ) {
line 1083
;1083: *buf++ = ( flags & ZEROPAD ) ? '0' : ' ';
ADDRLP4 48
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 48
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRFP4 12
INDIRI4
CNSTI4 128
BANDI4
CNSTI4 0
EQI4 $295
ADDRLP4 44
CNSTI4 48
ASGNI4
ADDRGP4 $296
JUMPV
LABELV $295
ADDRLP4 44
CNSTI4 32
ASGNI4
LABELV $296
ADDRLP4 48
INDIRP4
ADDRLP4 44
INDIRI4
CVII1 4
ASGNI1
line 1084
;1084: width--;
ADDRFP4 8
ADDRFP4 8
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
line 1085
;1085: }
LABELV $292
line 1082
ADDRLP4 0
INDIRI4
ADDRFP4 8
INDIRI4
LTI4 $291
line 1086
;1086: }
ADDRGP4 $298
JUMPV
LABELV $297
line 1088
;1087:
;1088: while ( digits-- ) {
line 1089
;1089: *buf++ = text[digits];
ADDRLP4 44
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 44
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 44
INDIRP4
ADDRLP4 0
INDIRI4
ADDRLP4 8
ADDP4
INDIRI1
ASGNI1
line 1090
;1090: width--;
ADDRFP4 8
ADDRFP4 8
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
line 1091
;1091: }
LABELV $298
line 1088
ADDRLP4 44
ADDRLP4 0
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 44
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
ADDRLP4 44
INDIRI4
CNSTI4 0
NEI4 $297
line 1093
;1092:
;1093: if( flags & LADJUST ) {
ADDRFP4 12
INDIRI4
CNSTI4 4
BANDI4
CNSTI4 0
EQI4 $300
ADDRGP4 $303
JUMPV
LABELV $302
line 1094
;1094: while ( width-- ) {
line 1095
;1095: *buf++ = ( flags & ZEROPAD ) ? '0' : ' ';
ADDRLP4 52
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 52
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRFP4 12
INDIRI4
CNSTI4 128
BANDI4
CNSTI4 0
EQI4 $306
ADDRLP4 48
CNSTI4 48
ASGNI4
ADDRGP4 $307
JUMPV
LABELV $306
ADDRLP4 48
CNSTI4 32
ASGNI4
LABELV $307
ADDRLP4 52
INDIRP4
ADDRLP4 48
INDIRI4
CVII1 4
ASGNI1
line 1096
;1096: }
LABELV $303
line 1094
ADDRLP4 48
ADDRFP4 8
INDIRI4
ASGNI4
ADDRFP4 8
ADDRLP4 48
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
ADDRLP4 48
INDIRI4
CNSTI4 0
NEI4 $302
line 1097
;1097: }
LABELV $300
line 1099
;1098:
;1099: *buf_p = buf;
ADDRFP4 0
INDIRP4
ADDRLP4 4
INDIRP4
ASGNP4
line 1100
;1100:}
LABELV $281
endproc AddInt 56 0
export AddFloat
proc AddFloat 60 0
line 1102
;1101:
;1102:void AddFloat( char **buf_p, float fval, int width, int prec ) {
line 1110
;1103: char text[32];
;1104: int digits;
;1105: float signedVal;
;1106: char *buf;
;1107: int val;
;1108:
;1109: // get the sign
;1110: signedVal = fval;
ADDRLP4 44
ADDRFP4 4
INDIRF4
ASGNF4
line 1111
;1111: if ( fval < 0 ) {
ADDRFP4 4
INDIRF4
CNSTF4 0
GEF4 $309
line 1112
;1112: fval = -fval;
ADDRFP4 4
ADDRFP4 4
INDIRF4
NEGF4
ASGNF4
line 1113
;1113: }
LABELV $309
line 1116
;1114:
;1115: // write the float number
;1116: digits = 0;
ADDRLP4 0
CNSTI4 0
ASGNI4
line 1117
;1117: val = (int)fval;
ADDRLP4 4
ADDRFP4 4
INDIRF4
CVFI4 4
ASGNI4
LABELV $311
line 1118
;1118: do {
line 1119
;1119: text[digits++] = '0' + val % 10;
ADDRLP4 48
ADDRLP4 0
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 48
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 48
INDIRI4
ADDRLP4 8
ADDP4
ADDRLP4 4
INDIRI4
CNSTI4 10
MODI4
CNSTI4 48
ADDI4
CVII1 4
ASGNI1
line 1120
;1120: val /= 10;
ADDRLP4 4
ADDRLP4 4
INDIRI4
CNSTI4 10
DIVI4
ASGNI4
line 1121
;1121: } while ( val );
LABELV $312
ADDRLP4 4
INDIRI4
CNSTI4 0
NEI4 $311
line 1123
;1122:
;1123: if ( signedVal < 0 ) {
ADDRLP4 44
INDIRF4
CNSTF4 0
GEF4 $314
line 1124
;1124: text[digits++] = '-';
ADDRLP4 48
ADDRLP4 0
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 48
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 48
INDIRI4
ADDRLP4 8
ADDP4
CNSTI1 45
ASGNI1
line 1125
;1125: }
LABELV $314
line 1127
;1126:
;1127: buf = *buf_p;
ADDRLP4 40
ADDRFP4 0
INDIRP4
INDIRP4
ASGNP4
ADDRGP4 $317
JUMPV
LABELV $316
line 1129
;1128:
;1129: while ( digits < width ) {
line 1130
;1130: *buf++ = ' ';
ADDRLP4 48
ADDRLP4 40
INDIRP4
ASGNP4
ADDRLP4 40
ADDRLP4 48
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 48
INDIRP4
CNSTI1 32
ASGNI1
line 1131
;1131: width--;
ADDRFP4 8
ADDRFP4 8
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
line 1132
;1132: }
LABELV $317
line 1129
ADDRLP4 0
INDIRI4
ADDRFP4 8
INDIRI4
LTI4 $316
ADDRGP4 $320
JUMPV
LABELV $319
line 1134
;1133:
;1134: while ( digits-- ) {
line 1135
;1135: *buf++ = text[digits];
ADDRLP4 48
ADDRLP4 40
INDIRP4
ASGNP4
ADDRLP4 40
ADDRLP4 48
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 48
INDIRP4
ADDRLP4 0
INDIRI4
ADDRLP4 8
ADDP4
INDIRI1
ASGNI1
line 1136
;1136: }
LABELV $320
line 1134
ADDRLP4 48
ADDRLP4 0
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 48
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
ADDRLP4 48
INDIRI4
CNSTI4 0
NEI4 $319
line 1138
;1137:
;1138: *buf_p = buf;
ADDRFP4 0
INDIRP4
ADDRLP4 40
INDIRP4
ASGNP4
line 1140
;1139:
;1140: if (prec < 0)
ADDRFP4 12
INDIRI4
CNSTI4 0
GEI4 $322
line 1141
;1141: prec = 6;
ADDRFP4 12
CNSTI4 6
ASGNI4
LABELV $322
line 1143
;1142: // write the fraction
;1143: digits = 0;
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $325
JUMPV
LABELV $324
line 1144
;1144: while (digits < prec) {
line 1145
;1145: fval -= (int) fval;
ADDRLP4 52
ADDRFP4 4
INDIRF4
ASGNF4
ADDRFP4 4
ADDRLP4 52
INDIRF4
ADDRLP4 52
INDIRF4
CVFI4 4
CVIF4 4
SUBF4
ASGNF4
line 1146
;1146: fval *= 10.0;
ADDRFP4 4
CNSTF4 1092616192
ADDRFP4 4
INDIRF4
MULF4
ASGNF4
line 1147
;1147: val = (int) fval;
ADDRLP4 4
ADDRFP4 4
INDIRF4
CVFI4 4
ASGNI4
line 1148
;1148: text[digits++] = '0' + val % 10;
ADDRLP4 56
ADDRLP4 0
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 56
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
ADDRLP4 56
INDIRI4
ADDRLP4 8
ADDP4
ADDRLP4 4
INDIRI4
CNSTI4 10
MODI4
CNSTI4 48
ADDI4
CVII1 4
ASGNI1
line 1149
;1149: }
LABELV $325
line 1144
ADDRLP4 0
INDIRI4
ADDRFP4 12
INDIRI4
LTI4 $324
line 1151
;1150:
;1151: if (digits > 0) {
ADDRLP4 0
INDIRI4
CNSTI4 0
LEI4 $327
line 1152
;1152: buf = *buf_p;
ADDRLP4 40
ADDRFP4 0
INDIRP4
INDIRP4
ASGNP4
line 1153
;1153: *buf++ = '.';
ADDRLP4 52
ADDRLP4 40
INDIRP4
ASGNP4
ADDRLP4 40
ADDRLP4 52
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 52
INDIRP4
CNSTI1 46
ASGNI1
line 1154
;1154: for (prec = 0; prec < digits; prec++) {
ADDRFP4 12
CNSTI4 0
ASGNI4
ADDRGP4 $332
JUMPV
LABELV $329
line 1155
;1155: *buf++ = text[prec];
ADDRLP4 56
ADDRLP4 40
INDIRP4
ASGNP4
ADDRLP4 40
ADDRLP4 56
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 56
INDIRP4
ADDRFP4 12
INDIRI4
ADDRLP4 8
ADDP4
INDIRI1
ASGNI1
line 1156
;1156: }
LABELV $330
line 1154
ADDRFP4 12
ADDRFP4 12
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $332
ADDRFP4 12
INDIRI4
ADDRLP4 0
INDIRI4
LTI4 $329
line 1157
;1157: *buf_p = buf;
ADDRFP4 0
INDIRP4
ADDRLP4 40
INDIRP4
ASGNP4
line 1158
;1158: }
LABELV $327
line 1159
;1159:}
LABELV $308
endproc AddFloat 60 0
export AddString
proc AddString 20 4
line 1162
;1160:
;1161:
;1162:void AddString( char **buf_p, char *string, int width, int prec ) {
line 1166
;1163: int size;
;1164: char *buf;
;1165:
;1166: buf = *buf_p;
ADDRLP4 4
ADDRFP4 0
INDIRP4
INDIRP4
ASGNP4
line 1168
;1167:
;1168: if ( string == NULL ) {
ADDRFP4 4
INDIRP4
CVPU4 4
CNSTU4 0
NEU4 $334
line 1169
;1169: string = "(null)";
ADDRFP4 4
ADDRGP4 $336
ASGNP4
line 1170
;1170: prec = -1;
ADDRFP4 12
CNSTI4 -1
ASGNI4
line 1171
;1171: }
LABELV $334
line 1173
;1172:
;1173: if ( prec >= 0 ) {
ADDRFP4 12
INDIRI4
CNSTI4 0
LTI4 $337
line 1174
;1174: for( size = 0; size < prec; size++ ) {
ADDRLP4 0
CNSTI4 0
ASGNI4
ADDRGP4 $342
JUMPV
LABELV $339
line 1175
;1175: if( string[size] == '\0' ) {
ADDRLP4 0
INDIRI4
ADDRFP4 4
INDIRP4
ADDP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $343
line 1176
;1176: break;
ADDRGP4 $338
JUMPV
LABELV $343
line 1178
;1177: }
;1178: }
LABELV $340
line 1174
ADDRLP4 0
ADDRLP4 0
INDIRI4
CNSTI4 1
ADDI4
ASGNI4
LABELV $342
ADDRLP4 0
INDIRI4
ADDRFP4 12
INDIRI4
LTI4 $339
line 1179
;1179: }
ADDRGP4 $338
JUMPV
LABELV $337
line 1180
;1180: else {
line 1181
;1181: size = strlen( string );
ADDRFP4 4
INDIRP4
ARGP4
ADDRLP4 8
ADDRGP4 strlen
CALLI4
ASGNI4
ADDRLP4 0
ADDRLP4 8
INDIRI4
ASGNI4
line 1182
;1182: }
LABELV $338
line 1184
;1183:
;1184: width -= size;
ADDRFP4 8
ADDRFP4 8
INDIRI4
ADDRLP4 0
INDIRI4
SUBI4
ASGNI4
ADDRGP4 $346
JUMPV
LABELV $345
line 1186
;1185:
;1186: while( size-- ) {
line 1187
;1187: *buf++ = *string++;
ADDRLP4 8
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 16
CNSTI4 1
ASGNI4
ADDRLP4 4
ADDRLP4 8
INDIRP4
ADDRLP4 16
INDIRI4
ADDP4
ASGNP4
ADDRLP4 12
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 4
ADDRLP4 12
INDIRP4
ADDRLP4 16
INDIRI4
ADDP4
ASGNP4
ADDRLP4 8
INDIRP4
ADDRLP4 12
INDIRP4
INDIRI1
ASGNI1
line 1188
;1188: }
LABELV $346
line 1186
ADDRLP4 8
ADDRLP4 0
INDIRI4
ASGNI4
ADDRLP4 0
ADDRLP4 8
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
ADDRLP4 8
INDIRI4
CNSTI4 0
NEI4 $345
ADDRGP4 $349
JUMPV
LABELV $348
line 1190
;1189:
;1190: while( width-- > 0 ) {
line 1191
;1191: *buf++ = ' ';
ADDRLP4 12
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 12
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 12
INDIRP4
CNSTI1 32
ASGNI1
line 1192
;1192: }
LABELV $349
line 1190
ADDRLP4 12
ADDRFP4 8
INDIRI4
ASGNI4
ADDRFP4 8
ADDRLP4 12
INDIRI4
CNSTI4 1
SUBI4
ASGNI4
ADDRLP4 12
INDIRI4
CNSTI4 0
GTI4 $348
line 1194
;1193:
;1194: *buf_p = buf;
ADDRFP4 0
INDIRP4
ADDRLP4 4
INDIRP4
ASGNP4
line 1195
;1195:}
LABELV $333
endproc AddString 20 4
export vsprintf
proc vsprintf 72 16
line 1205
;1196:
;1197:/*
;1198:vsprintf
;1199:
;1200:I'm not going to support a bunch of the more arcane stuff in here
;1201:just to keep it simpler. For example, the '*' and '$' are not
;1202:currently supported. I've tried to make it so that it will just
;1203:parse and ignore formats we don't support.
;1204:*/
;1205:int vsprintf( char *buffer, const char *fmt, va_list argptr ) {
line 1215
;1206: int *arg;
;1207: char *buf_p;
;1208: char ch;
;1209: int flags;
;1210: int width;
;1211: int prec;
;1212: int n;
;1213: char sign;
;1214:
;1215: buf_p = buffer;
ADDRLP4 4
ADDRFP4 0
INDIRP4
ASGNP4
line 1216
;1216: arg = (int *)argptr;
ADDRLP4 24
ADDRFP4 8
INDIRP4
ASGNP4
ADDRGP4 $353
JUMPV
LABELV $352
line 1218
;1217:
;1218: while( qtrue ) {
line 1220
;1219: // run through the format string until we hit a '%' or '\0'
;1220: for ( ch = *fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++ ) {
ADDRLP4 0
ADDRFP4 4
INDIRP4
INDIRI1
ASGNI1
ADDRGP4 $358
JUMPV
LABELV $355
line 1221
;1221: *buf_p++ = ch;
ADDRLP4 32
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 32
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 32
INDIRP4
ADDRLP4 0
INDIRI1
ASGNI1
line 1222
;1222: }
LABELV $356
line 1220
ADDRFP4 4
ADDRFP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
LABELV $358
ADDRLP4 29
ADDRFP4 4
INDIRP4
INDIRI1
ASGNI1
ADDRLP4 0
ADDRLP4 29
INDIRI1
ASGNI1
ADDRLP4 29
INDIRI1
CVII4 1
CNSTI4 0
EQI4 $359
ADDRLP4 0
INDIRI1
CVII4 1
CNSTI4 37
NEI4 $355
LABELV $359
line 1223
;1223: if ( ch == '\0' ) {
ADDRLP4 0
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $360
line 1224
;1224: goto done;
ADDRGP4 $362
JUMPV
LABELV $360
line 1228
;1225: }
;1226:
;1227: // skip over the '%'
;1228: fmt++;
ADDRFP4 4
ADDRFP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 1231
;1229:
;1230: // reset formatting state
;1231: flags = 0;
ADDRLP4 16
CNSTI4 0
ASGNI4
line 1232
;1232: width = 0;
ADDRLP4 12
CNSTI4 0
ASGNI4
line 1233
;1233: prec = -1;
ADDRLP4 20
CNSTI4 -1
ASGNI4
line 1234
;1234: sign = '\0';
ADDRLP4 28
CNSTI1 0
ASGNI1
LABELV $363
line 1237
;1235:
;1236:rflag:
;1237: ch = *fmt++;
ADDRLP4 32
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 4
ADDRLP4 32
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 0
ADDRLP4 32
INDIRP4
INDIRI1
ASGNI1
LABELV $364
line 1239
;1238:reswitch:
;1239: switch( ch ) {
ADDRLP4 36
ADDRLP4 0
INDIRI1
CVII4 1
ASGNI4
ADDRLP4 36
INDIRI4
CNSTI4 99
LTI4 $386
ADDRLP4 36
INDIRI4
CNSTI4 105
GTI4 $387
ADDRLP4 36
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 $388-396
ADDP4
INDIRP4
JUMPV
lit
align 4
LABELV $388
address $381
address $382
address $365
address $383
address $365
address $365
address $382
code
LABELV $386
ADDRLP4 36
INDIRI4
CNSTI4 37
LTI4 $365
ADDRLP4 36
INDIRI4
CNSTI4 57
GTI4 $365
ADDRLP4 36
INDIRI4
CNSTI4 2
LSHI4
ADDRGP4 $390-148
ADDP4
INDIRP4
JUMPV
lit
align 4
LABELV $390
address $385
address $365
address $365
address $365
address $365
address $365
address $365
address $365
address $368
address $369
address $365
address $376
address $377
address $377
address $377
address $377
address $377
address $377
address $377
address $377
address $377
code
LABELV $387
ADDRLP4 36
INDIRI4
CNSTI4 115
EQI4 $384
ADDRGP4 $365
JUMPV
LABELV $368
line 1241
;1240: case '-':
;1241: flags |= LADJUST;
ADDRLP4 16
ADDRLP4 16
INDIRI4
CNSTI4 4
BORI4
ASGNI4
line 1242
;1242: goto rflag;
ADDRGP4 $363
JUMPV
LABELV $369
line 1244
;1243: case '.':
;1244: n = 0;
ADDRLP4 8
CNSTI4 0
ASGNI4
ADDRGP4 $371
JUMPV
LABELV $370
line 1245
;1245: while( is_digit( ( ch = *fmt++ ) ) ) {
line 1246
;1246: n = 10 * n + ( ch - '0' );
ADDRLP4 8
CNSTI4 10
ADDRLP4 8
INDIRI4
MULI4
ADDRLP4 0
INDIRI1
CVII4 1
CNSTI4 48
SUBI4
ADDI4
ASGNI4
line 1247
;1247: }
LABELV $371
line 1245
ADDRLP4 48
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 4
ADDRLP4 48
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 52
ADDRLP4 48
INDIRP4
INDIRI1
ASGNI1
ADDRLP4 0
ADDRLP4 52
INDIRI1
ASGNI1
ADDRLP4 52
INDIRI1
CVII4 1
CNSTI4 48
SUBI4
CVIU4 4
CNSTU4 9
LEU4 $370
line 1248
;1248: prec = n < 0 ? -1 : n;
ADDRLP4 8
INDIRI4
CNSTI4 0
GEI4 $374
ADDRLP4 56
CNSTI4 -1
ASGNI4
ADDRGP4 $375
JUMPV
LABELV $374
ADDRLP4 56
ADDRLP4 8
INDIRI4
ASGNI4
LABELV $375
ADDRLP4 20
ADDRLP4 56
INDIRI4
ASGNI4
line 1249
;1249: goto reswitch;
ADDRGP4 $364
JUMPV
LABELV $376
line 1251
;1250: case '0':
;1251: flags |= ZEROPAD;
ADDRLP4 16
ADDRLP4 16
INDIRI4
CNSTI4 128
BORI4
ASGNI4
line 1252
;1252: goto rflag;
ADDRGP4 $363
JUMPV
LABELV $377
line 1262
;1253: case '1':
;1254: case '2':
;1255: case '3':
;1256: case '4':
;1257: case '5':
;1258: case '6':
;1259: case '7':
;1260: case '8':
;1261: case '9':
;1262: n = 0;
ADDRLP4 8
CNSTI4 0
ASGNI4
LABELV $378
line 1263
;1263: do {
line 1264
;1264: n = 10 * n + ( ch - '0' );
ADDRLP4 8
CNSTI4 10
ADDRLP4 8
INDIRI4
MULI4
ADDRLP4 0
INDIRI1
CVII4 1
CNSTI4 48
SUBI4
ADDI4
ASGNI4
line 1265
;1265: ch = *fmt++;
ADDRLP4 60
ADDRFP4 4
INDIRP4
ASGNP4
ADDRFP4 4
ADDRLP4 60
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 0
ADDRLP4 60
INDIRP4
INDIRI1
ASGNI1
line 1266
;1266: } while( is_digit( ch ) );
LABELV $379
ADDRLP4 0
INDIRI1
CVII4 1
CNSTI4 48
SUBI4
CVIU4 4
CNSTU4 9
LEU4 $378
line 1267
;1267: width = n;
ADDRLP4 12
ADDRLP4 8
INDIRI4
ASGNI4
line 1268
;1268: goto reswitch;
ADDRGP4 $364
JUMPV
LABELV $381
line 1270
;1269: case 'c':
;1270: *buf_p++ = (char)*arg;
ADDRLP4 60
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 60
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 60
INDIRP4
ADDRLP4 24
INDIRP4
INDIRI4
CVII1 4
ASGNI1
line 1271
;1271: arg++;
ADDRLP4 24
ADDRLP4 24
INDIRP4
CNSTI4 4
ADDP4
ASGNP4
line 1272
;1272: break;
ADDRGP4 $366
JUMPV
LABELV $382
line 1275
;1273: case 'd':
;1274: case 'i':
;1275: AddInt( &buf_p, *arg, width, flags );
ADDRLP4 4
ARGP4
ADDRLP4 24
INDIRP4
INDIRI4
ARGI4
ADDRLP4 12
INDIRI4
ARGI4
ADDRLP4 16
INDIRI4
ARGI4
ADDRGP4 AddInt
CALLV
pop
line 1276
;1276: arg++;
ADDRLP4 24
ADDRLP4 24
INDIRP4
CNSTI4 4
ADDP4
ASGNP4
line 1277
;1277: break;
ADDRGP4 $366
JUMPV
LABELV $383
line 1279
;1278: case 'f':
;1279: AddFloat( &buf_p, *(double *)arg, width, prec );
ADDRLP4 4
ARGP4
ADDRLP4 24
INDIRP4
INDIRF4
ARGF4
ADDRLP4 12
INDIRI4
ARGI4
ADDRLP4 20
INDIRI4
ARGI4
ADDRGP4 AddFloat
CALLV
pop
line 1281
;1280:#ifdef __LCC__
;1281: arg += 1; // everything is 32 bit in my compiler
ADDRLP4 24
ADDRLP4 24
INDIRP4
CNSTI4 4
ADDP4
ASGNP4
line 1285
;1282:#else
;1283: arg += 2;
;1284:#endif
;1285: break;
ADDRGP4 $366
JUMPV
LABELV $384
line 1287
;1286: case 's':
;1287: AddString( &buf_p, (char *)*arg, width, prec );
ADDRLP4 4
ARGP4
ADDRLP4 24
INDIRP4
INDIRI4
CVIU4 4
CVUP4 4
ARGP4
ADDRLP4 12
INDIRI4
ARGI4
ADDRLP4 20
INDIRI4
ARGI4
ADDRGP4 AddString
CALLV
pop
line 1288
;1288: arg++;
ADDRLP4 24
ADDRLP4 24
INDIRP4
CNSTI4 4
ADDP4
ASGNP4
line 1289
;1289: break;
ADDRGP4 $366
JUMPV
LABELV $385
line 1291
;1290: case '%':
;1291: *buf_p++ = ch;
ADDRLP4 64
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 64
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 64
INDIRP4
ADDRLP4 0
INDIRI1
ASGNI1
line 1292
;1292: break;
ADDRGP4 $366
JUMPV
LABELV $365
line 1294
;1293: default:
;1294: *buf_p++ = (char)*arg;
ADDRLP4 68
ADDRLP4 4
INDIRP4
ASGNP4
ADDRLP4 4
ADDRLP4 68
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
ADDRLP4 68
INDIRP4
ADDRLP4 24
INDIRP4
INDIRI4
CVII1 4
ASGNI1
line 1295
;1295: arg++;
ADDRLP4 24
ADDRLP4 24
INDIRP4
CNSTI4 4
ADDP4
ASGNP4
line 1296
;1296: break;
LABELV $366
line 1298
;1297: }
;1298: }
LABELV $353
line 1218
ADDRGP4 $352
JUMPV
LABELV $362
line 1301
;1299:
;1300:done:
;1301: *buf_p = 0;
ADDRLP4 4
INDIRP4
CNSTI1 0
ASGNI1
line 1302
;1302: return buf_p - buffer;
ADDRLP4 4
INDIRP4
CVPU4 4
ADDRFP4 0
INDIRP4
CVPU4 4
SUBU4
CVUI4 4
RETI4
LABELV $351
endproc vsprintf 72 16
export sscanf
proc sscanf 28 4
line 1307
;1303:}
;1304:
;1305:
;1306:/* this is really crappy */
;1307:int sscanf( const char *buffer, const char *fmt, ... ) {
line 1312
;1308: int cmd;
;1309: int **arg;
;1310: int count;
;1311:
;1312: arg = (int **)&fmt + 1;
ADDRLP4 4
ADDRFP4 4+4
ASGNP4
line 1313
;1313: count = 0;
ADDRLP4 8
CNSTI4 0
ASGNI4
ADDRGP4 $395
JUMPV
LABELV $394
line 1315
;1314:
;1315: while ( *fmt ) {
line 1316
;1316: if ( fmt[0] != '%' ) {
ADDRFP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 37
EQI4 $397
line 1317
;1317: fmt++;
ADDRFP4 4
ADDRFP4 4
INDIRP4
CNSTI4 1
ADDP4
ASGNP4
line 1318
;1318: continue;
ADDRGP4 $395
JUMPV
LABELV $397
line 1321
;1319: }
;1320:
;1321: cmd = fmt[1];
ADDRLP4 0
ADDRFP4 4
INDIRP4
CNSTI4 1
ADDP4
INDIRI1
CVII4 1
ASGNI4
line 1322
;1322: fmt += 2;
ADDRFP4 4
ADDRFP4 4
INDIRP4
CNSTI4 2
ADDP4
ASGNP4
line 1324
;1323:
;1324: switch ( cmd ) {
ADDRLP4 16
CNSTI4 100
ASGNI4
ADDRLP4 0
INDIRI4
ADDRLP4 16
INDIRI4
EQI4 $401
ADDRLP4 0
INDIRI4
CNSTI4 102
EQI4 $402
ADDRLP4 0
INDIRI4
CNSTI4 105
EQI4 $401
ADDRLP4 0
INDIRI4
ADDRLP4 16
INDIRI4
LTI4 $399
LABELV $403
ADDRLP4 0
INDIRI4
CNSTI4 117
EQI4 $401
ADDRGP4 $399
JUMPV
LABELV $401
line 1328
;1325: case 'i':
;1326: case 'd':
;1327: case 'u':
;1328: **arg = _atoi( &buffer );
ADDRFP4 0
ARGP4
ADDRLP4 20
ADDRGP4 _atoi
CALLI4
ASGNI4
ADDRLP4 4
INDIRP4
INDIRP4
ADDRLP4 20
INDIRI4
ASGNI4
line 1329
;1329: break;
ADDRGP4 $400
JUMPV
LABELV $402
line 1331
;1330: case 'f':
;1331: *(float *)*arg = _atof( &buffer );
ADDRFP4 0
ARGP4
ADDRLP4 24
ADDRGP4 _atof
CALLF4
ASGNF4
ADDRLP4 4
INDIRP4
INDIRP4
ADDRLP4 24
INDIRF4
ASGNF4
line 1332
;1332: break;
LABELV $399
LABELV $400
line 1334
;1333: }
;1334: arg++;
ADDRLP4 4
ADDRLP4 4
INDIRP4
CNSTI4 4
ADDP4
ASGNP4
line 1335
;1335: }
LABELV $395
line 1315
ADDRFP4 4
INDIRP4
INDIRI1
CVII4 1
CNSTI4 0
NEI4 $394
line 1337
;1336:
;1337: return count;
ADDRLP4 8
INDIRI4
RETI4
LABELV $392
endproc sscanf 28 4
import Com_Printf
import Com_Error
import Info_NextPair
import Info_Validate
import Info_SetValueForKey_Big
import Info_SetValueForKey
import Info_RemoveKey_big
import Info_RemoveKey
import Info_ValueForKey
import va
import Q_CleanStr
import Q_PrintStrlen
import Q_strcat
import Q_strncpyz
import Q_strrchr
import Q_strupr
import Q_strlwr
import Q_stricmpn
import Q_strncmp
import Q_stricmp
import Q_isalpha
import Q_isupper
import Q_islower
import Q_isprint
import Com_sprintf
import Parse3DMatrix
import Parse2DMatrix
import Parse1DMatrix
import SkipRestOfLine
import SkipBracedSection
import COM_MatchToken
import COM_ParseWarning
import COM_ParseError
import COM_Compress
import COM_ParseExt
import COM_Parse
import COM_GetCurrentParseLine
import COM_BeginParseSession
import COM_DefaultExtension
import COM_StripExtension
import COM_SkipPath
import Com_Clamp
import PerpendicularVector
import AngleVectors
import MatrixMultiply
import MakeNormalVectors
import RotateAroundDirection
import RotatePointAroundVector
import ProjectPointOnPlane
import PlaneFromPoints
import AngleDelta
import AngleNormalize180
import AngleNormalize360
import AnglesSubtract
import AngleSubtract
import LerpAngle
import AngleMod
import BoxOnPlaneSide
import SetPlaneSignbits
import AxisCopy
import AxisClear
import AnglesToAxis
import vectoangles
import Q_crandom
import Q_random
import Q_rand
import Q_acos
import Q_log2
import VectorRotate
import Vector4Scale
import VectorNormalize2
import VectorNormalize
import CrossProduct
import VectorInverse
import VectorNormalizeFast
import DistanceSquared
import Distance
import VectorLengthSquared
import VectorLength
import VectorCompare
import AddPointToBounds
import ClearBounds
import RadiusFromBounds
import NormalizeColor
import ColorBytes4
import ColorBytes3
import _VectorMA
import _VectorScale
import _VectorCopy
import _VectorAdd
import _VectorSubtract
import _DotProduct
import ByteToDir
import DirToByte
import ClampShort
import ClampChar
import Q_rsqrt
import Q_fabs
import axisDefault
import vec3_origin
import g_color_table
import colorDkGrey
import colorMdGrey
import colorLtGrey
import colorWhite
import colorCyan
import colorMagenta
import colorYellow
import colorBlue
import colorGreen
import colorRed
import colorBlack
import bytedirs
import Com_Memcpy
import Com_Memset
import Hunk_Alloc
import FloatSwap
import LongSwap
import ShortSwap
import acos
import atan2
import cos
import sin
import sqrt
import floor
import ceil
import memcpy
import memset
import strncpy
lit
align 1
LABELV $336
byte 1 40
byte 1 110
byte 1 117
byte 1 108
byte 1 108
byte 1 41
byte 1 0