annotate src/number-mp.h @ 5077:d372b17f63ce

clean up toolbar/gutter edge geometry -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-25 Ben Wing <ben@xemacs.org> * EmacsFrame.c (EmacsFrameSetValues): * frame-impl.h: * frame-impl.h (struct frame): * frame-impl.h (FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT): * frame-impl.h (FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH): * frame-impl.h (FRAME_REAL_TOP_TOOLBAR_HEIGHT): * frame-impl.h (FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH): * frame-impl.h (FRAME_REAL_TOP_TOOLBAR_VISIBLE): * frame-impl.h (FRAME_REAL_TOP_TOOLBAR_BOUNDS): * frame.h: * frame.h (enum edge_pos): * gutter.c: * gutter.c (get_gutter_coords): * gutter.c (display_boxes_in_gutter_p): * gutter.c (construct_window_gutter_spec): * gutter.c (calculate_gutter_size_from_display_lines): * gutter.c (calculate_gutter_size): * gutter.c (output_gutter): * gutter.c (clear_gutter): * gutter.c (mark_gutters): * gutter.c (gutter_extent_signal_changed_region_maybe): * gutter.c (update_gutter_geometry): * gutter.c (update_frame_gutter_geometry): * gutter.c (update_frame_gutters): * gutter.c (reset_gutter_display_lines): * gutter.c (redraw_exposed_gutter): * gutter.c (redraw_exposed_gutters): * gutter.c (free_frame_gutters): * gutter.c (decode_gutter_position): * gutter.c (Fset_default_gutter_position): * gutter.c (Fgutter_pixel_width): * gutter.c (Fgutter_pixel_height): * gutter.c (recompute_overlaying_specifier): * gutter.c (gutter_specs_changed_1): * gutter.c (gutter_specs_changed): * gutter.c (top_gutter_specs_changed): * gutter.c (bottom_gutter_specs_changed): * gutter.c (left_gutter_specs_changed): * gutter.c (right_gutter_specs_changed): * gutter.c (gutter_geometry_changed_in_window): * gutter.c (init_frame_gutters): * gutter.c (specifier_vars_of_gutter): * gutter.h: * gutter.h (WINDOW_REAL_TOP_GUTTER_BOUNDS): * gutter.h (FRAME_TOP_GUTTER_BOUNDS): * lisp.h (enum edge_style): * native-gtk-toolbar.c: * native-gtk-toolbar.c (gtk_output_toolbar): * native-gtk-toolbar.c (gtk_clear_toolbar): * native-gtk-toolbar.c (gtk_output_frame_toolbars): * native-gtk-toolbar.c (gtk_initialize_frame_toolbars): * toolbar-msw.c: * toolbar-msw.c (TOOLBAR_HANDLE): * toolbar-msw.c (allocate_toolbar_item_id): * toolbar-msw.c (mswindows_clear_toolbar): * toolbar-msw.c (mswindows_output_toolbar): * toolbar-msw.c (mswindows_move_toolbar): * toolbar-msw.c (mswindows_redraw_exposed_toolbars): * toolbar-msw.c (mswindows_initialize_frame_toolbars): * toolbar-msw.c (mswindows_output_frame_toolbars): * toolbar-msw.c (mswindows_clear_frame_toolbars): * toolbar-msw.c (DELETE_TOOLBAR): * toolbar-msw.c (mswindows_free_frame_toolbars): * toolbar-msw.c (mswindows_get_toolbar_button_text): * toolbar-xlike.c: * toolbar-xlike.c (__prepare_button_area): * toolbar-xlike.c (XLIKE_OUTPUT_BUTTONS_LOOP): * toolbar-xlike.c (xlike_output_toolbar): * toolbar-xlike.c (xlike_clear_toolbar): * toolbar-xlike.c (xlike_output_frame_toolbars): * toolbar-xlike.c (xlike_clear_frame_toolbars): * toolbar-xlike.c (xlike_redraw_exposed_toolbar): * toolbar-xlike.c (xlike_redraw_exposed_toolbars): * toolbar-xlike.c (xlike_redraw_frame_toolbars): * toolbar.c: * toolbar.c (decode_toolbar_position): * toolbar.c (Fset_default_toolbar_position): * toolbar.c (mark_frame_toolbar_buttons_dirty): * toolbar.c (compute_frame_toolbar_buttons): * toolbar.c (set_frame_toolbar): * toolbar.c (compute_frame_toolbars_data): * toolbar.c (update_frame_toolbars_geometry): * toolbar.c (init_frame_toolbars): * toolbar.c (get_toolbar_coords): * toolbar.c (CHECK_TOOLBAR): * toolbar.c (toolbar_buttons_at_pixpos): * toolbar.c (CTB_ERROR): * toolbar.c (recompute_overlaying_specifier): * toolbar.c (specifier_vars_of_toolbar): * toolbar.h: * toolbar.h (SET_TOOLBAR_WAS_VISIBLE_FLAG): Create new enum edge_pos with TOP_EDGE, BOTTOM_EDGE, LEFT_EDGE, RIGHT_EDGE; subsume TOP_BORDER, TOP_GUTTER, enum toolbar_pos, enum gutter_pos, etc. Create EDGE_POS_LOOP, subsuming GUTTER_POS_LOOP. Create NUM_EDGES, use in many places instead of hardcoded '4'. Instead of top_toolbar_was_visible, bottom_toolbar_was_visible, etc. make an array toolbar_was_visible[NUM_EDGES]. This increases the frame size by 15 bytes or so (could be 3 if we use Boolbytes) but hardly seems w to matter -- frames are heavy weight objects anyway. Same with top_gutter_was_visible, etc. Remove duplicated SET_TOOLBAR_WAS_VISIBLE_FLAG and put defn in one place (toolbar.h).
author Ben Wing <ben@xemacs.org>
date Thu, 25 Feb 2010 04:45:13 -0600
parents 2fc0e2f18322
children ba07c880114a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1983
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
1 /* Definitions of numeric types for XEmacs using the MP library.
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
2 Copyright (C) 2004 Jerry James.
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
3
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
4 This file is part of XEmacs.
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
5
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
9 later version.
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
10
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
14 for more details.
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
15
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
4802
2fc0e2f18322 Don't create any bignums before pdumping. Add bignum, ratio, and bigfloat
Jerry James <james@xemacs.org>
parents: 1983
diff changeset
18 the Free Software Foundation, Inc., 51 Franklin St - Fifth Floor,
2fc0e2f18322 Don't create any bignums before pdumping. Add bignum, ratio, and bigfloat
Jerry James <james@xemacs.org>
parents: 1983
diff changeset
19 Boston, MA 02111-1301, USA. */
1983
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
20
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
22
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
23 /* This library defines the following types:
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
24 bignum = MINT
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
25
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
26 The MP library does not include support for ratios or bigfloats.
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
27 */
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
28
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
29 #ifndef INCLUDED_number_mp_h_
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
30 #define INCLUDED_number_mp_h_
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
31
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
32 /* BSD MP libraries without MP_PREFIX define a function named pow in mp.h that
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
33 has a different prototype from the one in math.h. We don't use that
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
34 function anyway, so we do this for safety purposes. However, this means
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
35 that number-mp.h must always be included before math.h. */
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
36 #define pow mp_pow
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
37 #include <mp.h>
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
38 #undef pow
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
39
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
40 #ifdef MP_PREFIX
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
41 #define MP_GCD mp_gcd
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
42 #define MP_ITOM mp_itom
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
43 #define MP_MADD mp_madd
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
44 #define MP_MCMP mp_mcmp
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
45 #define MP_MDIV mp_mdiv
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
46 #define MP_MFREE mp_mfree
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
47 #define MP_MSUB mp_msub
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
48 #define MP_MULT mp_mult
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
49 #define MP_SDIV mp_sdiv
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
50 #ifdef HAVE_MP_MOVE
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
51 #define MP_MOVE(x,y) mp_move (x, y)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
52 #else
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
53 #define MP_MOVE(x,y) mp_madd (x, bignum_zero, y)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
54 #endif
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
55 #else
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
56 #define MP_GCD gcd
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
57 #define MP_ITOM itom
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
58 #define MP_MADD madd
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
59 #define MP_MCMP mcmp
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
60 #define MP_MDIV mdiv
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
61 #define MP_MFREE mfree
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
62 #define MP_MSUB msub
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
63 #define MP_MULT mult
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
64 #define MP_SDIV sdiv
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
65 #ifdef HAVE_MP_MOVE
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
66 #define MP_MOVE(x,y) move (x, y)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
67 #else
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
68 #define MP_MOVE(x,y) madd (x, bignum_zero, y)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
69 #endif
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
70 #endif
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
71
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
72 typedef MINT *bignum;
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
73
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
74 extern void init_number_mp(void);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
75
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
76
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
77 /********************************* Bignums **********************************/
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
78
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
79 #define HAVE_BIGNUM 1
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
80
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
81 extern MINT *bignum_zero, *intern_bignum;
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
82 extern MINT *bignum_min_int, *bignum_max_int, *bignum_max_uint;
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
83 extern MINT *bignum_min_long, *bignum_max_long, *bignum_max_ulong;
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
84 extern short div_rem;
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
85
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
86 /***** Bignum: basic functions *****/
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
87 #define bignum_init(b) (b = MP_ITOM (0))
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
88 #define bignum_fini(b) MP_MFREE (b)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
89 #define bignum_hashcode(b) bignum_to_uint (b)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
90 #define bignum_sign(b) MP_MCMP (b, bignum_zero)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
91 #define bignum_evenp(b) (MP_SDIV (b, 2, intern_bignum, &div_rem), \
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
92 div_rem == 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
93 #define bignum_oddp(b) (MP_SDIV (b, 2, intern_bignum, &div_rem), \
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
94 div_rem != 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
95
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
96 /***** Bignum: size *****/
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
97 #define bignum_fits_int_p(b) (MP_MCMP (b, bignum_min_int) >= 0 && \
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
98 MP_MCMP (b, bignum_max_int) <= 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
99 #define bignum_fits_uint_p(b) (MP_MCMP (b, bignum_zero) >= 0 && \
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
100 MP_MCMP (b, bignum_max_uint) <= 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
101 #define bignum_fits_long_p(b) (MP_MCMP (b, bignum_min_long) >= 0 && \
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
102 MP_MCMP (b, bignum_max_long) <= 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
103 #define bignum_fits_ulong_p(b) (MP_MCMP (b, bignum_zero) >= 0 && \
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
104 MP_MCMP (b, bignum_max_ulong) <= 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
105
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
106 /***** Bignum: conversions *****/
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
107 extern char *bignum_to_string(bignum, int);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
108 extern int bignum_to_int(bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
109 extern unsigned int bignum_to_uint(bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
110 extern long bignum_to_long(bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
111 extern unsigned long bignum_to_ulong(bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
112 extern double bignum_to_double(bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
113
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
114 /***** Bignum: converting assignments *****/
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
115 #define bignum_set(b1, b2) MP_MOVE (b2, b1)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
116 extern int bignum_set_string(bignum, const char *, int);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
117 extern void bignum_set_long(bignum, long);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
118 extern void bignum_set_ulong(bignum, unsigned long);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
119 extern void bignum_set_double(bignum, double);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
120
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
121 /***** Bignum: comparisons *****/
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
122 #define bignum_cmp(b1,b2) MP_MCMP (b1, b2)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
123 #define bignum_lt(b1,b2) (MP_MCMP (b1, b2) < 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
124 #define bignum_le(b1,b2) (MP_MCMP (b1, b2) <= 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
125 #define bignum_eql(b1,b2) (MP_MCMP (b1, b2) == 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
126 #define bignum_ge(b1,b2) (MP_MCMP (b1, b2) >= 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
127 #define bignum_gt(b1,b2) (MP_MCMP (b1, b2) > 0)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
128
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
129 /***** Bignum: arithmetic *****/
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
130 #define bignum_neg(b,b2) MP_MSUB (bignum_zero, b2, b)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
131 #define bignum_abs(b,b2) (MP_MCMP (b2, bignum_zero) < 0 \
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
132 ? MP_MSUB (bignum_zero, b2, b) \
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
133 : MP_MADD (bignum_zero, b2, b))
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
134 #define bignum_add(b,b1,b2) MP_MADD (b1, b2, b)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
135 #define bignum_sub(b,b1,b2) MP_MSUB (b1, b2, b)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
136 #define bignum_mul(b,b1,b2) MP_MULT (b1, b2, b)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
137 extern int bignum_divisible_p(bignum, bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
138 #define bignum_div(b,b1,b2) MP_MDIV (b1, b2, b, intern_bignum)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
139 extern void bignum_ceil(bignum, bignum, bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
140 extern void bignum_floor(bignum, bignum, bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
141 #define bignum_mod(b,b1,b2) MP_MDIV (b1, b2, intern_bignum, b)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
142 extern void bignum_pow(bignum, bignum, unsigned long);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
143 #define bignum_gcd(res,b1,b2) MP_GCD (b1, b2, res)
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
144 extern void bignum_lcm(bignum, bignum, bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
145
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
146 /***** Bignum: bit manipulations *****/
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
147 extern void bignum_and(bignum, bignum, bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
148 extern void bignum_ior(bignum, bignum, bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
149 extern void bignum_xor(bignum, bignum, bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
150 extern void bignum_not(bignum, bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
151 extern void bignum_setbit(bignum, unsigned long);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
152 extern void bignum_clrbit(bignum, unsigned long);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
153 extern int bignum_testbit(bignum, unsigned long);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
154 extern void bignum_lshift(bignum, bignum, unsigned long);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
155 extern void bignum_rshift(bignum, bignum, unsigned long);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
156
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
157 /***** Bignum: random numbers *****/
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
158 extern void bignum_random_seed(unsigned long);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
159 extern void bignum_random(bignum, bignum);
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
160
9c872f33ecbe [xemacs-hg @ 2004-04-05 22:49:31 by james]
james
parents:
diff changeset
161 #endif /* INCLUDED_number_mp_h_ */