[MINOR] time: add __usec_to_1024th to convert usecs to 1024th of second

This function performs a fast conversion from usec to 1024th of a second,
and will be useful for many fast sub-second computations.
diff --git a/include/common/time.h b/include/common/time.h
index 7dbed6d..07d3070 100644
--- a/include/common/time.h
+++ b/include/common/time.h
@@ -157,6 +157,18 @@
 	return tv;
 }
 
+/* Return a number of 1024Hz ticks between 0 and 1023 for input number of
+ * usecs between 0 and 999999. This function has been optimized to remove
+ * any divide and multiply, as it is completely optimized away by the compiler
+ * on CPUs which don't have a fast multiply. Its avg error rate is 305 ppm,
+ * which is almost twice as low as a direct usec to ms conversion. This version
+ * also has the benefit of returning 1024 for 1000000.
+ */
+REGPRM1 static inline unsigned int __usec_to_1024th(unsigned int usec)
+{
+	return (usec * 1073 + 742516) >> 20;
+}
+
 
 /**** comparison functions and macros ***********************************/