Changeset 6fc941 in git for Singular/ipconv.cc


Ignore:
Timestamp:
May 29, 2006, 6:10:50 PM (18 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
9f738e4e4d9a2396fedb4bf644b5fc7cbac460ad
Parents:
7145030af0d072406bdbbd5f4cbd550cdea8ccba
Message:
*hannes: bigint prep (3)


git-svn-id: file:///usr/local/Singular/svn/trunk@9173 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/ipconv.cc

    r714503 r6fc941  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ipconv.cc,v 1.28 2005-07-27 15:47:57 Singular Exp $ */
     4/* $Id: ipconv.cc,v 1.29 2006-05-29 16:10:50 Singular Exp $ */
    55/*
    66* ABSTRACT: automatic type conversions
     
    1717#include "subexpr.h"
    1818#include "numbers.h"
     19#include "modulop.h"
     20#include "longalg.h"
    1921#include "matpol.h"
    2022#include "silink.h"
     
    9698  return (void *)m;
    9799}
     100static void * iiBI2N(void *d)
     101{
     102  void *r=NULL;
     103  if (rField_is_Q())
     104    r=d;
     105  else
     106  {
     107    number n=(number)d;
     108    if (rField_is_Zp())
     109    {
     110      r=(void *)npMap0(n);
     111    }
     112    else if (rField_is_Q_a())
     113    {
     114      r=(void *)naMap00(n);
     115    }
     116    else if (rField_is_Zp_a())
     117    {
     118      r=(void *)naMap0P(n);
     119    }
     120    else
     121      WerrorS("cannot convert bigint to this field");
     122    nlDelete(&n,NULL);
     123  }
     124  return r;
     125}
     126
     127static void * iiN2P(void *data);
     128static void * iiBI2P(void *d)
     129{
     130  void *r=iiBI2N(d);
     131  if(errorreported) return NULL;
     132  else              return iiN2P(r);
     133}
    98134
    99135static void * iiDummy(void *data)
     
    124160{
    125161  number n=nInit((int)(long)data);
     162  return (void *)n;
     163}
     164
     165static void * iiI2BI(void *data)
     166{
     167  number n=nlInit((int)(long)data);
    126168  return (void *)n;
    127169}
     
    211253{
    212254//   input type       output type     convert procedure
     255//  int -> bigint
     256   { INT_CMD,         BIGINT_CMD,     iiI2BI , NULL },
    213257//  int -> number
    214258   { INT_CMD,         NUMBER_CMD,     iiI2N , NULL },
     
    229273//  intmat -> matrix
    230274   { INTMAT_CMD,      MATRIX_CMD,     iiIm2Ma , NULL },
     275//  bigint -> number
     276   { BIGINT_CMD,      NUMBER_CMD,     iiBI2N , NULL },
     277//  bigint -> poly
     278   { BIGINT_CMD,      NUMBER_CMD,     iiBI2P , NULL },
    231279//  number -> poly
    232280   { NUMBER_CMD,      POLY_CMD,       iiN2P  , NULL },
Note: See TracChangeset for help on using the changeset viewer.