Clean up warnings for round() function declaration.
[iverilog.git] / libveriuser / math.c
blob7456873ca8f447691fba1f47ab02164d03b841df
1 /*
2 * Copyright (c) 2003 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
8 * any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 #ifdef HAVE_CVS_IDENT
20 #ident "$Id: math.c,v 1.3 2003/06/13 19:23:42 steve Exp $"
21 #endif
23 # include <string.h>
24 # include <stdlib.h>
25 # include <assert.h>
26 # include "config.h"
27 # include "vpi_user.h"
28 # include "veriuser.h"
30 void tf_multiply_long(PLI_INT32*aof_low1, PLI_INT32*aof_high1,
31 PLI_INT32 aof_low2, PLI_INT32 aof_high2)
33 ivl_u64_t a, b;
34 a = *aof_high1;
35 a = (a << 32) | *aof_low1;
36 b = aof_high2;
37 b = (b << 32) | aof_low2;
38 a *= b;
39 *aof_high1 = (a >> 32) & 0xffffffff;
40 *aof_low1 = a & 0xffffffff;
43 void tf_real_to_long(double real, PLI_INT32*low, PLI_INT32*high)
45 ivl_u64_t rtn = (ivl_u64_t)real;
46 *high = (rtn >> 32) & 0xffffffff;
47 *low = rtn & 0xffffffff;
50 void tf_long_to_real(PLI_INT32 low, PLI_INT32 high, double *real)
52 ivl_u64_t a;
53 a = high;
54 a = (a << 32) | low;
55 *real = (double)a;
59 * $Log: math.c,v $
60 * Revision 1.3 2003/06/13 19:23:42 steve
61 * Add a bunch more PLI1 routines.
63 * Revision 1.2 2003/06/04 01:56:20 steve
64 * 1) Adds configure logic to clean up compiler warnings
65 * 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
66 * tf_isetrealdelay, acc_handle_scope
67 * 3) makes acc_next reentrant
68 * 4) adds basic vpiWire type support
69 * 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
70 * 6) add vpiLeftRange/RigthRange to signals
72 * Revision 1.1 2003/04/23 15:01:29 steve
73 * Add tf_synchronize and tf_multiply_long.