MCPcopy Create free account
hub / github.com/beanshell/beanshell / longBinaryOperation

Method longBinaryOperation

src/bsh/Primitive.java:315–389  ·  view source on GitHub ↗
(Long L1, Long L2, int kind)

Source from the content-addressed store, hash-verified

313
314 // returns Object covering both Long and Boolean return types
315 static Object longBinaryOperation(Long L1, Long L2, int kind)
316 {
317 long lhs = L1.longValue();
318 long rhs = L2.longValue();
319
320 switch(kind)
321 {
322 // boolean
323 case LT:
324 case LTX:
325 return lhs < rhs ? Boolean.TRUE : Boolean.FALSE;
326
327 case GT:
328 case GTX:
329 return lhs > rhs ? Boolean.TRUE : Boolean.FALSE;
330
331 case EQ:
332 return lhs == rhs ? Boolean.TRUE : Boolean.FALSE;
333
334 case LE:
335 case LEX:
336 return lhs <= rhs ? Boolean.TRUE : Boolean.FALSE;
337
338 case GE:
339 case GEX:
340 return lhs >= rhs ? Boolean.TRUE : Boolean.FALSE;
341
342 case NE:
343 return lhs != rhs ? Boolean.TRUE : Boolean.FALSE;
344
345 // arithmetic
346 case PLUS:
347 return new Long(lhs + rhs);
348
349 case MINUS:
350 return new Long(lhs - rhs);
351
352 case STAR:
353 return new Long(lhs * rhs);
354
355 case SLASH:
356 return new Long(lhs / rhs);
357
358 case MOD:
359 return new Long(lhs % rhs);
360
361 // bitwise
362 case LSHIFT:
363 case LSHIFTX:
364 return new Long(lhs << rhs);
365
366 case RSIGNEDSHIFT:
367 case RSIGNEDSHIFTX:
368 return new Long(lhs >> rhs);
369
370 case RUNSIGNEDSHIFT:
371 case RUNSIGNEDSHIFTX:
372 return new Long(lhs >>> rhs);

Callers 1

binaryOperationImplMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected