MCPcopy Index your code
hub / github.com/clojure/clojure / LongOps

Class LongOps

src/jvm/clojure/lang/Numbers.java:449–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449final static class LongOps implements Ops{
450 public Ops combine(Ops y){
451 return y.opsWith(this);
452 }
453
454 final public Ops opsWith(LongOps x){
455 return this;
456 }
457
458 final public Ops opsWith(DoubleOps x){
459 return DOUBLE_OPS;
460 }
461
462 final public Ops opsWith(RatioOps x){
463 return RATIO_OPS;
464 }
465
466 final public Ops opsWith(BigIntOps x){
467 return BIGINT_OPS;
468 }
469
470 final public Ops opsWith(BigDecimalOps x){
471 return BIGDECIMAL_OPS;
472 }
473
474 public boolean isZero(Number x){
475 return x.longValue() == 0;
476 }
477
478 public boolean isPos(Number x){
479 return x.longValue() > 0;
480 }
481
482 public boolean isNeg(Number x){
483 return x.longValue() < 0;
484 }
485
486 final public Number add(Number x, Number y){
487 return num(Numbers.add(x.longValue(),y.longValue()));
488 }
489
490 final public Number addP(Number x, Number y){
491 long lx = x.longValue(), ly = y.longValue();
492 long ret = lx + ly;
493 if ((ret ^ lx) < 0 && (ret ^ ly) < 0)
494 return BIGINT_OPS.add(x, y);
495 return num(ret);
496 }
497
498 final public Number unchecked_add(Number x, Number y){
499 return num(Numbers.unchecked_add(x.longValue(), y.longValue()));
500 }
501
502 final public Number multiply(Number x, Number y){
503 return num(Numbers.multiply(x.longValue(), y.longValue()));
504 }
505
506 final public Number multiplyP(Number x, Number y){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected