1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-29 04:51:28 +00:00

Maiko sources matching state as of 020102 prior to initial patching for Mac OSX

This commit is contained in:
Nick Briggs
2015-04-20 18:53:52 -07:00
commit de170a64d9
427 changed files with 129342 additions and 0 deletions

111
src/shift.c Executable file
View File

@@ -0,0 +1,111 @@
/* $Id: shift.c,v 1.3 1999/05/31 23:35:42 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
static char *id = "$Id: shift.c,v 1.3 1999/05/31 23:35:42 sybalsky Exp $ Copyright (C) Venue";
/************************************************************************/
/* */
/* (C) Copyright 1989-95 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#include "version.h"
#include <stdio.h>
#include "lispemul.h"
#include "lspglob.h"
#include "emlglob.h"
#include "adr68k.h"
#include "lispmap.h"
#include "lsptypes.h"
#include "arith.h"
#define LSH 0347
DLword *createcell68k(unsigned int type);
/************************************************************
N_OP_llsh1
entry LLSH1 OPCODE[0340]
return(a << 1)
************************************************************/
N_OP_llsh1(int a)
{
N_ARITH_BODY_1_UNSIGNED(a, 1, <<);
}
/************************************************************
N_OP_llsh8
entry LLSH8 OPCODE[0341]
return(a << 8)
************************************************************/
N_OP_llsh8(int a)
{
N_ARITH_BODY_1_UNSIGNED(a, 8, <<);
}
/************************************************************
N_OP_lrsh1
entry LRSH1 OPCODE[0342]
return(a >> 1)
************************************************************/
N_OP_lrsh1(int a)
{
N_ARITH_BODY_1_UNSIGNED(a, 1, >>);
}
/************************************************************
N_OP_lrsh8
entry LRSH8 OPCODE[0343]
return(a >> 8)
************************************************************/
N_OP_lrsh8(int a)
{
N_ARITH_BODY_1_UNSIGNED(a, 8, >>);
}
/************************************************************
N_OP_lsh
entry LSH OPCODE[0347]
return(a <?> b)
************************************************************/
N_OP_lsh(int a, int b)
{
register int arg,arg2;
register int size;
/*DLword *wordp;*/
N_GETNUMBER(b, size, do_ufn);
N_GETNUMBER(a, arg2, do_ufn);
if (size > 0) {
if (size > 31) goto do_ufn;
arg = arg2 << size;
if ((arg >> size) != arg2) goto do_ufn;
} else
if (size < 0) {
if (size < -31) goto do_ufn;
arg = arg2 >> -size;
/*** Commented out JDS 1/27/89: This punts if you shifted ***/
/*** ANY 1 bits off the right edge. You CAN'T overflow ***/
/*** in this direction!! ***/
/* if ((arg << -size) != arg2) goto do_ufn; */
} else return(a);
N_ARITH_SWITCH(arg);
do_ufn: ERROR_EXIT(b);
}