patch 8.2.3449: sort fails if the sort compare function returns 999

Problem:    Sort fails if the sort compare function returns 999.
Solution:   Adjust value to -1 / 0 / 1. (Yasuhiro Matsumoto, closes #8884)
diff --git a/src/list.c b/src/list.c
index 8e67a61..16e5983 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1945,7 +1945,13 @@
     if (res == FAIL)
 	res = ITEM_COMPARE_FAIL;
     else
+    {
 	res = (int)tv_get_number_chk(&rettv, &sortinfo->item_compare_func_err);
+	if (res > 0)
+	    res = 1;
+	else if (res < 0)
+	    res = -1;
+    }
     if (sortinfo->item_compare_func_err)
 	res = ITEM_COMPARE_FAIL;  // return value has wrong type
     clear_tv(&rettv);