767 {
768 if (typeof(TOther) == typeof(byte))
769 {
770 byte b = (byte)(
object)
value;
771 if (b > 127)
772 {
773 result = 0;
774 return false;
775 }
776 result = (sbyte)b;
777 return true;
778 }
779 if (typeof(TOther) == typeof(char))
780 {
781 char c = (char)(
object)
value;
782 if (c > '\u007f')
783 {
784 result = 0;
785 return false;
786 }
787 result = (sbyte)c;
788 return true;
789 }
790 if (typeof(TOther) == typeof(decimal))
791 {
792 decimal num = (decimal)(
object)
value;
793 if (num < -128m || num > 127m)
794 {
795 result = 0;
796 return false;
797 }
798 result = (sbyte)num;
799 return true;
800 }
801 if (typeof(TOther) == typeof(double))
802 {
803 double num2 = (double)(
object)
value;
804 if (num2 < -128.0 || num2 > 127.0)
805 {
806 result = 0;
807 return false;
808 }
809 result = (sbyte)num2;
810 return true;
811 }
812 if (typeof(TOther) == typeof(short))
813 {
815 if (num3 < -128 || num3 > 127)
816 {
817 result = 0;
818 return false;
819 }
820 result = (sbyte)num3;
821 return true;
822 }
823 if (typeof(TOther) == typeof(int))
824 {
825 int num4 = (int)(
object)
value;
826 if (num4 < -128 || num4 > 127)
827 {
828 result = 0;
829 return false;
830 }
831 result = (sbyte)num4;
832 return true;
833 }
834 if (typeof(TOther) == typeof(long))
835 {
836 long num5 = (long)(
object)
value;
837 if (num5 < -128 || num5 > 127)
838 {
839 result = 0;
840 return false;
841 }
842 result = (sbyte)num5;
843 return true;
844 }
845 if (typeof(TOther) == typeof(IntPtr))
846 {
848 if ((nint)intPtr < -128 || (nint)intPtr > 127)
849 {
850 result = 0;
851 return false;
852 }
853 result = (sbyte)(nint)intPtr;
854 return true;
855 }
856 if (typeof(TOther) == typeof(sbyte))
857 {
858 result = (sbyte)(
object)
value;
859 return true;
860 }
861 if (typeof(TOther) == typeof(float))
862 {
863 float num6 = (float)(
object)
value;
864 if (num6 < -128f || num6 > 127f)
865 {
866 result = 0;
867 return false;
868 }
869 result = (sbyte)num6;
870 return true;
871 }
872 if (typeof(TOther) == typeof(ushort))
873 {
874 ushort num7 = (ushort)(
object)
value;
875 if (num7 > 127)
876 {
877 result = 0;
878 return false;
879 }
880 result = (sbyte)num7;
881 return true;
882 }
883 if (typeof(TOther) == typeof(uint))
884 {
885 uint num8 = (uint)(
object)
value;
886 if ((
long)num8 > 127
L)
887 {
888 result = 0;
889 return false;
890 }
891 result = (sbyte)num8;
892 return true;
893 }
894 if (typeof(TOther) == typeof(ulong))
895 {
896 ulong num9 = (ulong)(
object)
value;
897 if (num9 > 127)
898 {
899 result = 0;
900 return false;
901 }
902 result = (sbyte)num9;
903 return true;
904 }
905 if (typeof(TOther) == typeof(UIntPtr))
906 {
908 if ((nuint)uIntPtr > 127)
909 {
910 result = 0;
911 return false;
912 }
913 result = (sbyte)(nuint)uIntPtr;
914 return true;
915 }
916 ThrowHelper.ThrowNotSupportedException();
917 result = 0;
918 return false;
919 }