Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ShiftRight.cs
1using System;
6
8{
13 {
23 : base(Left, Right, Start, Length, Expression)
24 {
25 }
26
33 public override IElement Evaluate(double Left, double Right)
34 {
35 sbyte R;
36
37 if (Left != Math.Floor(Left) || Right != Math.Floor(Right))
38 throw new ScriptRuntimeException("Operands must be integer values.", this);
39
40 if (Right < sbyte.MinValue || Right > sbyte.MaxValue)
41 throw new ScriptRuntimeException("Operand out of bounds.", this);
42
43 R = (sbyte)Right;
44
45 if (Left < 0)
46 {
47 if (Left < long.MinValue)
48 throw new ScriptRuntimeException("Operand out of bounds.", this);
49
50 return new DoubleNumber(((long)Left) >> R);
51 }
52 else
53 {
54 if (Left > ulong.MaxValue)
55 throw new ScriptRuntimeException("Operand out of bounds.", this);
56
57 return new DoubleNumber(((ulong)Left) >> R);
58 }
59 }
60 }
61}
Class managing a script expression.
Definition: Expression.cs:39
Base class for binary double operators.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
override IElement Evaluate(double Left, double Right)
Evaluates the double operator.
Definition: ShiftRight.cs:33
ShiftRight(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
Shift right operator.
Definition: ShiftRight.cs:22
Basic interface for all types of elements.
Definition: IElement.cs:20