llvm/polly/lib/External/isl/imath/imrat.c

/*
  Name:     imrat.c
  Purpose:  Arbitrary precision rational arithmetic routines.
  Author:   M. J. Fromberger

  Copyright (C) 2002-2007 Michael J. Fromberger, All Rights Reserved.

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
 */

#include "imrat.h"
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>

#define MP_NUMER_SIGN(Q)
#define MP_DENOM_SIGN(Q)

#define TEMP(K)
#define SETUP(E, C)

/* Reduce the given rational, in place, to lowest terms and canonical form.
   Zero is represented as 0/1, one as 1/1.  Signs are adjusted so that the sign
   of the numerator is definitive. */
static mp_result s_rat_reduce(mp_rat r);

/* Common code for addition and subtraction operations on rationals. */
static mp_result s_rat_combine(mp_rat a, mp_rat b, mp_rat c,
                               mp_result (*comb_f)(mp_int, mp_int, mp_int));

mp_result mp_rat_init(mp_rat r) {}

mp_rat mp_rat_alloc(void) {}

mp_result mp_rat_reduce(mp_rat r) {}

mp_result mp_rat_init_size(mp_rat r, mp_size n_prec, mp_size d_prec) {}

mp_result mp_rat_init_copy(mp_rat r, mp_rat old) {}

mp_result mp_rat_set_value(mp_rat r, mp_small numer, mp_small denom) {}

mp_result mp_rat_set_uvalue(mp_rat r, mp_usmall numer, mp_usmall denom) {}

void mp_rat_clear(mp_rat r) {}

void mp_rat_free(mp_rat r) {}

mp_result mp_rat_numer(mp_rat r, mp_int z) {}

mp_int mp_rat_numer_ref(mp_rat r) {}

mp_result mp_rat_denom(mp_rat r, mp_int z) {}

mp_int mp_rat_denom_ref(mp_rat r) {}

mp_sign mp_rat_sign(mp_rat r) {}

mp_result mp_rat_copy(mp_rat a, mp_rat c) {}

void mp_rat_zero(mp_rat r) {}

mp_result mp_rat_abs(mp_rat a, mp_rat c) {}

mp_result mp_rat_neg(mp_rat a, mp_rat c) {}

mp_result mp_rat_recip(mp_rat a, mp_rat c) {}

mp_result mp_rat_add(mp_rat a, mp_rat b, mp_rat c) {}

mp_result mp_rat_sub(mp_rat a, mp_rat b, mp_rat c) {}

mp_result mp_rat_mul(mp_rat a, mp_rat b, mp_rat c) {}

mp_result mp_rat_div(mp_rat a, mp_rat b, mp_rat c) {}

mp_result mp_rat_add_int(mp_rat a, mp_int b, mp_rat c) {}

mp_result mp_rat_sub_int(mp_rat a, mp_int b, mp_rat c) {}

mp_result mp_rat_mul_int(mp_rat a, mp_int b, mp_rat c) {}

mp_result mp_rat_div_int(mp_rat a, mp_int b, mp_rat c) {}

mp_result mp_rat_expt(mp_rat a, mp_small b, mp_rat c) {}

int mp_rat_compare(mp_rat a, mp_rat b) {}

int mp_rat_compare_unsigned(mp_rat a, mp_rat b) {}

int mp_rat_compare_zero(mp_rat r) {}

int mp_rat_compare_value(mp_rat r, mp_small n, mp_small d) {}

bool mp_rat_is_integer(mp_rat r) {}

mp_result mp_rat_to_ints(mp_rat r, mp_small *num, mp_small *den) {}

mp_result mp_rat_to_string(mp_rat r, mp_size radix, char *str, int limit) {}

mp_result mp_rat_to_decimal(mp_rat r, mp_size radix, mp_size prec,
                            mp_round_mode round, char *str, int limit) {}

mp_result mp_rat_string_len(mp_rat r, mp_size radix) {}

mp_result mp_rat_decimal_len(mp_rat r, mp_size radix, mp_size prec) {}

mp_result mp_rat_read_string(mp_rat r, mp_size radix, const char *str) {}

mp_result mp_rat_read_cstring(mp_rat r, mp_size radix, const char *str,
                              char **end) {}

/* Read a string and figure out what format it's in.  The radix may be supplied
   as zero to use "default" behaviour.

   This function will accept either a/b notation or decimal notation.
 */
mp_result mp_rat_read_ustring(mp_rat r, mp_size radix, const char *str,
                              char **end) {}

mp_result mp_rat_read_decimal(mp_rat r, mp_size radix, const char *str) {}

mp_result mp_rat_read_cdecimal(mp_rat r, mp_size radix, const char *str,
                               char **end) {}

/* Private functions for internal use.  Make unchecked assumptions about format
   and validity of inputs. */

static mp_result s_rat_reduce(mp_rat r) {}

static mp_result s_rat_combine(mp_rat a, mp_rat b, mp_rat c,
                               mp_result (*comb_f)(mp_int, mp_int, mp_int)) {}

/* Here there be dragons */