/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: a_bshf.c,v 1.2 1997/09/25 16:50:28 ae59 Exp $ */
/*
$Log: a_bshf.c,v $
 * Revision 1.2  1997/09/25  16:50:28  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:20:41  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : a_bshf.c                              */
/*                                                              */
/*      Entries         : a_intg a_bshf(a,m)                    */
/*                        a_intg a;                             */
/*                        a_intg m;                             */
/*                                                              */
/*      Arguments       : a = integer bit operand               */
/*                        m = shift value                       */
/*                                                              */
/*      Description     : Bit SHIFT of an integer a             */
/*                        m positions to the left if m>0, or    */
/*                        m positions to the right if m<0       */
/*                                                              */
/*      Function value  : logically SHIFTed integer a           */
/*                        represented as integer                */
/*                                                              */
/*      Date            : 1991-02-25                            */
/*      1991-02-25 : new routine                                */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
local a_intg a_bshf(a_intg a,a_intg m)
#else
local a_intg a_bshf(a,m)

a_intg a;
a_intg m;
#endif
        {

        E_TPUSH("a_bshf")

        if (m<-B_LENGTH+1 || m>B_LENGTH-1) a = 0;
        else if (m<0) a = ((a_btyp)a)>>-m;
        else if (m>0) a <<= m;

        E_TPOPP("a_bshf")
        return(a);
        }

