Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
And.cs
1using System;
6
8{
13 {
22 public And(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
23 : base(Left, Right, Start, Length, Expression)
24 {
25 }
26
33 public override IElement Evaluate(double Left, double Right)
34 {
35 ulong L = ToUInt64(Left, out bool LSigned, this);
36 ulong R = ToUInt64(Right, out bool RSigned, this);
37
38 L &= R;
39
40 if (LSigned && RSigned)
41 return new DoubleNumber((long)L);
42 else
43 return new DoubleNumber(L);
44 }
45
46 internal static ulong ToUInt64(double Operand, out bool Signed, ScriptNode Node)
47 {
48 if (Operand != Math.Floor(Operand))
50
51 ulong Result;
52
53 if (Operand < 0)
54 {
55 Signed = true;
56 if (Operand < long.MinValue)
58
59 Result = (ulong)(long)Operand;
60 }
61 else
62 {
63 Signed = false;
64 if (Operand > ulong.MaxValue)
66
67 Result = (ulong)Operand;
68 }
69
70 return Result;
71 }
72 }
73}
Class managing a script expression.
Definition: Expression.cs:41
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
And(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
Binary And.
Definition: And.cs:22
override IElement Evaluate(double Left, double Right)
Evaluates the double operator.
Definition: And.cs:33
Basic interface for all types of elements.
Definition: IElement.cs:21