Micro-optimize cmap subtable format 4 loading
diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
index cde727b..3954d5c 100644
--- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py
+++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
@@ -665,18 +665,22 @@
 		charCodes = []
 		gids = []
 		for i in range(len(startCode) - 1):	# don't do 0xffff!
+			start = startCode[i]
+			delta = idDelta[i]
+			rangeOffset = idRangeOffset[i]
+			# *someone* needs to get killed.
+			partial = rangeOffset // 2 - start + i - len(idRangeOffset)
+
 			rangeCharCodes = list(range(startCode[i], endCode[i] + 1))
 			charCodes.extend(rangeCharCodes)
 			for charCode in rangeCharCodes:
-				rangeOffset = idRangeOffset[i]
 				if rangeOffset == 0:
-					glyphID = charCode + idDelta[i]
+					glyphID = charCode + delta
 				else:
-					# *someone* needs to get killed.
-					index = rangeOffset // 2 + (charCode - startCode[i]) + i - len(idRangeOffset)
+					index = charCode + partial
 					assert (index < lenGIArray), "In format 4 cmap, range (%d), the calculated index (%d) into the glyph index array  is not less than the length of the array (%d) !" % (i, index, lenGIArray)
 					if glyphIndexArray[index] != 0:  # if not missing glyph
-						glyphID = glyphIndexArray[index] + idDelta[i]
+						glyphID = glyphIndexArray[index] + delta
 					else:
 						glyphID = 0  # missing glyph
 				gids.append(glyphID % 0x10000)