Commit b687bdec authored by claes's avatar claes

Bitwise objects added

parent e69382ff
/*
* Proview $Id: rt_plc_arithm.c,v 1.8 2007-10-16 06:39:09 claes Exp $
* Proview $Id: rt_plc_arithm.c,v 1.9 2007-10-30 07:29:48 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1188,6 +1188,52 @@ void Min_exec(
o->ActVal = result;
}
/*_*
BwShiftLeft Bitwise shift left.
@aref bwshiftleft BwShiftLeft
*/
void BwShiftLeft_exec(
plc_sThread *tp,
pwr_sClass_BwShiftLeft *o)
{
o->Out = (*o->InP) << (*o->NumP);
}
/*_*
BwShiftRight Bitwise shift right.
@aref bwshiftright BwShiftRight
*/
void BwShiftRight_exec(
plc_sThread *tp,
pwr_sClass_BwShiftRight *o)
{
o->Out = (*o->InP) >> (*o->NumP);
}
/*_*
BwRotateRight Bitwise rotate right.
@aref bwrotateright BwRotateRight
*/
void BwRotateRight_exec(
plc_sThread *tp,
pwr_sClass_BwRotateRight *o)
{
o->Out = ((unsigned int)(*o->InP) << (32 - *o->NumP)) |
((unsigned int)(*o->InP) >> (*o->NumP));
}
/*_*
BwRotateLeft Bitwise rotate left.
@aref bwrotateleft BwRotateLeft
*/
void BwRotateLeft_exec(
plc_sThread *tp,
pwr_sClass_BwRotateLeft *o)
{
o->Out = ((unsigned int)(*o->InP) >> (32 - *o->NumP)) |
((unsigned int)(*o->InP) << (*o->NumP));
}
......
/*
* Proview $Id: rt_plc_macro_div.h,v 1.5 2006-05-23 13:53:47 claes Exp $
* Proview $Id: rt_plc_macro_div.h,v 1.6 2007-10-30 07:29:48 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -156,6 +156,12 @@
#define BwOr_exec(t, o)\
o->Status = *o->In1P | *o->In2P;
/*_*
@aref bwand BwInv
*/
#define BwInv_exec(t, o)\
o->Out = ~(*o->InP);
/*_*
@aref getdatap GetDatap
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment