Index: wp-includes/query.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wp-includes/query.php	(revision 5020135a109b4aff4f52cb4602910af7dfb25e37)
+++ wp-includes/query.php	(revision )
@@ -790,6 +790,83 @@
 	$wp_query->the_post();
 }
 
+/**
+ * @param WP_Query $wp_query
+ *
+ * @return int
+ */
+
+function get_loop_last_index( $wp_query = null ) {
+	if ( $wp_query == null ) {
+		global $wp_query;
+	}
+
+	return $wp_query->post_count - 1;
+}
+
+/**
+ * @param WP_Query $wp_query
+ *
+ * @return int
+ */
+function get_loop_index( $wp_query = null ) {
+	if ( $wp_query == null ) {
+		global $wp_query;
+	}
+
+	return $wp_query->current_post;
+}
+
+/**
+ * @param int $index
+ * @param WP_Query $wp_query
+ *
+ * @return bool
+ */
+
+function is_loop_index( $index, $wp_query = null ) {
+	return get_loop_index( $wp_query ) == $index;
+}
+
+/**
+ * @param WP_Query $wp_query
+ *
+ * @return bool
+ */
+function is_loop_first( $wp_query = null ) {
+	return get_loop_index( $wp_query ) == 0;
+}
+
+/**
+ * @param WP_Query $wp_query
+ *
+ * @return bool
+ */
+
+function is_loop_last( $wp_query = null ) {
+	return get_loop_index( $wp_query ) == get_loop_last_index( $wp_query );
+}
+
+/**
+ * @param WP_Query $wp_query
+ *
+ * @return bool
+ */
+
+function is_loop_even( $wp_query = null ) {
+	return ( get_loop_index( $wp_query ) + 1 ) % 2 == 0;
+}
+
+/**
+ * @param WP_Query $wp_query
+ *
+ * @return bool
+ */
+
+function is_loop_odd( $wp_query = null ) {
+	return ( get_loop_index( $wp_query ) + 1 ) % 2 != 0;
+}
+
 /*
  * Comments loop.
  */
