@@ -116,65 +116,65 @@ public void Visit(BinaryExpression expression)
116116 expression . RightExpression . Accept ( this ) ;
117117 object right = result ;
118118
119- if ( left is int && right is int )
119+ if ( left is long && right is long )
120120 {
121121 switch ( expression . Type )
122122 {
123123 case BinaryExpressionType . Plus :
124- result = Convert . ToInt32 ( left ) + Convert . ToInt32 ( right ) ;
124+ result = Convert . ToInt64 ( left ) + Convert . ToInt64 ( right ) ;
125125 break ;
126126 case BinaryExpressionType . Minus :
127- result = Convert . ToInt32 ( left ) - Convert . ToInt32 ( right ) ;
127+ result = Convert . ToInt64 ( left ) - Convert . ToInt64 ( right ) ;
128128 break ;
129129 case BinaryExpressionType . Multiply :
130- result = Convert . ToInt32 ( left ) * Convert . ToInt32 ( right ) ;
130+ result = Convert . ToInt64 ( left ) * Convert . ToInt64 ( right ) ;
131131 break ;
132132 case BinaryExpressionType . Div :
133- result = Convert . ToInt32 ( left ) / Convert . ToInt32 ( right ) ;
133+ result = Convert . ToInt64 ( left ) / Convert . ToInt64 ( right ) ;
134134 break ;
135135 case BinaryExpressionType . Mod :
136- result = Convert . ToInt32 ( left ) % Convert . ToInt32 ( right ) ;
136+ result = Convert . ToInt64 ( left ) % Convert . ToInt64 ( right ) ;
137137 break ;
138138 case BinaryExpressionType . ShiftLeft :
139- result = Convert . ToInt32 ( left ) << Convert . ToInt32 ( right ) ;
139+ result = Convert . ToInt64 ( left ) << Convert . ToInt32 ( right ) ;
140140 break ;
141141 case BinaryExpressionType . ShiftRight :
142- result = Convert . ToInt32 ( left ) >> Convert . ToInt32 ( right ) ;
142+ result = Convert . ToInt64 ( left ) >> Convert . ToInt32 ( right ) ;
143143 break ;
144144 case BinaryExpressionType . GreaterOrEqual :
145- result = ( Convert . ToInt32 ( left ) >= Convert . ToInt32 ( right ) ) ? 1 : 0 ;
145+ result = ( Convert . ToInt64 ( left ) >= Convert . ToInt64 ( right ) ) ? 1 : 0 ;
146146 break ;
147147 case BinaryExpressionType . LesserOrEqual :
148- result = ( Convert . ToInt32 ( left ) <= Convert . ToInt32 ( right ) ) ? 1 : 0 ;
148+ result = ( Convert . ToInt64 ( left ) <= Convert . ToInt64 ( right ) ) ? 1 : 0 ;
149149 break ;
150150 case BinaryExpressionType . Greater :
151- result = ( Convert . ToInt32 ( left ) > Convert . ToInt32 ( right ) ) ? 1 : 0 ;
151+ result = ( Convert . ToInt64 ( left ) > Convert . ToInt64 ( right ) ) ? 1 : 0 ;
152152 break ;
153153 case BinaryExpressionType . Lesser :
154- result = ( Convert . ToInt32 ( left ) < Convert . ToInt32 ( right ) ) ? 1 : 0 ;
154+ result = ( Convert . ToInt64 ( left ) < Convert . ToInt64 ( right ) ) ? 1 : 0 ;
155155 break ;
156156 case BinaryExpressionType . Equal :
157- result = ( Convert . ToInt32 ( left ) == Convert . ToInt32 ( right ) ) ? 1 : 0 ;
157+ result = ( Convert . ToInt64 ( left ) == Convert . ToInt64 ( right ) ) ? 1 : 0 ;
158158 break ;
159159 case BinaryExpressionType . NotEqual :
160- result = ( Convert . ToInt32 ( left ) != Convert . ToInt32 ( right ) ) ? 1 : 0 ;
160+ result = ( Convert . ToInt64 ( left ) != Convert . ToInt64 ( right ) ) ? 1 : 0 ;
161161 break ;
162162 case BinaryExpressionType . BitXor :
163- result = Convert . ToInt32 ( left ) ^ Convert . ToInt32 ( right ) ;
163+ result = Convert . ToInt64 ( left ) ^ Convert . ToInt64 ( right ) ;
164164 break ;
165165 case BinaryExpressionType . BitAnd :
166- result = Convert . ToInt32 ( left ) & Convert . ToInt32 ( right ) ;
166+ result = Convert . ToInt64 ( left ) & Convert . ToInt64 ( right ) ;
167167 break ;
168168 case BinaryExpressionType . BitOr :
169- result = Convert . ToInt32 ( left ) | Convert . ToInt32 ( right ) ;
169+ result = Convert . ToInt64 ( left ) | Convert . ToInt64 ( right ) ;
170170 break ;
171171 case BinaryExpressionType . And :
172172 bool andResult = Convert . ToBoolean ( left ) && Convert . ToBoolean ( right ) ;
173- result = Convert . ToInt32 ( andResult ) ;
173+ result = Convert . ToInt64 ( andResult ) ;
174174 break ;
175175 case BinaryExpressionType . Or :
176176 bool orResult = Convert . ToBoolean ( left ) || Convert . ToBoolean ( right ) ;
177- result = Convert . ToInt32 ( orResult ) ;
177+ result = Convert . ToInt64 ( orResult ) ;
178178 break ;
179179 default :
180180 throw new ExpressionEvaluatorException (
@@ -205,10 +205,10 @@ public void Visit(ValueExpression expression)
205205 switch ( expression . Type )
206206 {
207207 case ValueExpressionType . Integer :
208- result = int . Parse ( expression . Text ) ;
208+ result = long . Parse ( expression . Text ) ;
209209 break ;
210210 case ValueExpressionType . Variable :
211- int value ;
211+ long value ;
212212 int dereferencedValue ;
213213 int pointerValue ;
214214 if ( context . TryResolveSymbol ( expression . Text , out value ) )
@@ -258,7 +258,7 @@ public void Visit(FunctionExpression expression)
258258 if ( expression . FunctionName == "sizeof" )
259259 {
260260 string customTypeName ;
261- int symbolValue ;
261+ long symbolValue ;
262262 if ( param is string )
263263 {
264264 if ( ( context . TryResolveCustomType ( ( string ) param , out customTypeName )
@@ -301,8 +301,8 @@ public void Visit(FunctionExpression expression)
301301
302302 result = DatatypeInfoProvider . GetRpcDatatypeLength ( typeName ) ;
303303 }
304- if ( result is int
305- && ( int ) result <= 0 )
304+ if ( result is long
305+ && ( long ) result <= 0 )
306306 {
307307 throw new ExpressionEvaluatorException (
308308 String . Format ( "cannot get the datatype length for the datatype '{0}'" , param ) ) ;
@@ -323,9 +323,9 @@ public void Visit(UnaryExpression expression)
323323 }
324324
325325 expression . Expression . Accept ( this ) ;
326- if ( result is int )
326+ if ( result is long )
327327 {
328- int param = ( int ) result ;
328+ long param = ( long ) result ;
329329 switch ( expression . Type )
330330 {
331331 case UnaryExpressionType . Not :
@@ -356,7 +356,6 @@ public void Visit(UnaryExpression expression)
356356 else
357357 {
358358 IntPtr p = new IntPtr ( param ) ;
359- // only supports 32bit pointer here. To support 64bit, too much work to do
360359 result = System . Runtime . InteropServices . Marshal . ReadInt32 ( p ) ;
361360 }
362361 break ;
@@ -385,9 +384,9 @@ public void Visit(ConditionalExpression expression)
385384 expression . FirstExpression . Accept ( this ) ;
386385 object first = result ;
387386
388- if ( first is int )
387+ if ( first is long )
389388 {
390- if ( Convert . ToBoolean ( ( int ) first ) )
389+ if ( Convert . ToBoolean ( ( long ) first ) )
391390 {
392391 expression . SecondExpression . Accept ( this ) ;
393392 }
0 commit comments