PH Logo
Logo intepreter modeled after UCB Logo.
/Users/paul/Documents/phlogo/core/BitVerbs.cpp
00001 /*
00002  *  PredicateVerbs.cpp
00003  *
00004  *  Author: Paul Hamilton
00005  *      Date: 17 Aug 2011
00006  *
00007  */
00008 
00009 #include "Verbs.h"
00010 
00011 #include "Thing.h"
00012 #include "World.h"
00013 #include "TokenStream.h"
00014 
00015 #include <math.h>
00016 
00017 using namespace std;
00018 using namespace boost;
00019 
00020 namespace phlogo {
00021     
00022 void Verbs::bitAnd(TokenStream *ts) {
00023     
00024     setLongResult(getLong(ts) & getLong(ts));
00025     
00026 }
00027 
00028 void Verbs::bitOr(TokenStream *ts) {
00029     
00030     setLongResult(getLong(ts) | getLong(ts));
00031 
00032 }
00033 
00034 void Verbs::bitxor(TokenStream *ts) {
00035     
00036     setLongResult(getLong(ts) ^ getLong(ts));
00037 
00038 }
00039 
00040 void Verbs::bitnot(TokenStream *ts) {
00041     
00042     setLongResult(~getLong(ts));
00043 
00044 }
00045 
00046 void Verbs::lshift(TokenStream *ts) {
00047     
00048     long a = getLong(ts);
00049     long b = getLong(ts);
00050     
00051     if (b > 0)
00052         setLongResult(a << b);
00053     else
00054         setLongResult(a >> (-b));
00055 }
00056 
00057 }
 All Classes Functions