File: builtin-gcd.c

package info (click to toggle)
nickle 2.107
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,756 kB
  • sloc: ansic: 27,954; yacc: 1,874; lex: 954; sh: 204; makefile: 13; lisp: 1
file content (50 lines) | stat: -rw-r--r-- 916 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Copyright © 1988-2004 Keith Packard and Bart Massey.
 * All Rights Reserved.  See the file COPYING in this directory
 * for licensing information.
 */

/*
 *	gcd.c
 *
 *	provide builtin functions for the Gcd namespace
 */

#include	<ctype.h>
#include	<strings.h>
#include	<time.h>
#include	"builtin.h"

NamespacePtr GcdNamespace;

void
import_Gcd_namespace()
{
    ENTER ();
    static struct fbuiltin_2 funcs_2[] = {
        { do_Gcd_bdivmod, "bdivmod", "i", "ii" },
        { do_Gcd_kary_reduction, "kary_reduction", "i", "ii" },
        { 0 }
    };

    GcdNamespace = BuiltinNamespace (/*parent*/ 0, "Gcd")->namespace.namespace;

    BuiltinFuncs2 (&GcdNamespace, funcs_2);
    EXIT ();
}

#ifdef GCD_DEBUG
Value 
do_Gcd_bdivmod (Value a, Value b)
{
    ENTER ();
    RETURN (Bdivmod (a, b));
}

Value 
do_Gcd_kary_reduction (Value a, Value b)
{
    ENTER ();
    RETURN (KaryReduction (a, b));
}
#endif