505 {
506 if (typeof(TOther) == typeof(byte))
507 {
508 return (
byte)(object)
value;
509 }
510 if (typeof(TOther) == typeof(char))
511 {
512 return (
char)(object)
value;
513 }
514 if (typeof(TOther) == typeof(decimal))
515 {
516 decimal num = (decimal)(
object)
value;
517 if (!(num > 2147483647m))
518 {
519 if (!(num < -2147483648m))
520 {
521 return (int)num;
522 }
523 return int.MinValue;
524 }
525 return int.MaxValue;
526 }
527 if (typeof(TOther) == typeof(double))
528 {
529 double num2 = (double)(
object)
value;
530 if (!(num2 > 2147483647.0))
531 {
532 if (!(num2 < -2147483648.0))
533 {
534 return (int)num2;
535 }
536 return int.MinValue;
537 }
538 return int.MaxValue;
539 }
540 if (typeof(TOther) == typeof(short))
541 {
542 return (
short)(object)
value;
543 }
544 if (typeof(TOther) == typeof(int))
545 {
546 return (
int)(object)
value;
547 }
548 if (typeof(TOther) == typeof(long))
549 {
550 long num3 = (long)(
object)
value;
552 {
554 {
555 return (int)num3;
556 }
557 return int.MinValue;
558 }
559 return int.MaxValue;
560 }
561 if (typeof(TOther) == typeof(IntPtr))
562 {
564 if ((nint)intPtr <= int.MaxValue)
565 {
566 if ((nint)intPtr >= int.MinValue)
567 {
568 return (int)(nint)intPtr;
569 }
570 return int.MinValue;
571 }
572 return int.MaxValue;
573 }
574 if (typeof(TOther) == typeof(sbyte))
575 {
576 return (sbyte)(object)
value;
577 }
578 if (typeof(TOther) == typeof(float))
579 {
580 float num4 = (float)(
object)
value;
581 if (!(num4 > 2.1474836
E+09f))
582 {
583 if (!(num4 < -2.1474836
E+09f))
584 {
585 return (int)num4;
586 }
587 return int.MinValue;
588 }
589 return int.MaxValue;
590 }
591 if (typeof(TOther) == typeof(ushort))
592 {
593 return (ushort)(object)
value;
594 }
595 if (typeof(TOther) == typeof(uint))
596 {
597 uint num5 = (uint)(
object)
value;
599 {
600 return (int)num5;
601 }
602 return int.MaxValue;
603 }
604 if (typeof(TOther) == typeof(ulong))
605 {
606 ulong num6 = (ulong)(
object)
value;
608 {
609 return (int)num6;
610 }
611 return int.MaxValue;
612 }
613 if (typeof(TOther) == typeof(UIntPtr))
614 {
616 if ((nuint)uIntPtr <= int.MaxValue)
617 {
618 return (int)(nuint)uIntPtr;
619 }
620 return int.MaxValue;
621 }
622 ThrowHelper.ThrowNotSupportedException();
623 return 0;
624 }