Fix #1029: Avoid unnecessary instance tests when comparing Longs