From 5189ef945197da1a3276fdbe8799acb13739023c Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Thu, 13 Oct 2011 16:07:21 -0700
Subject: [PATCH] BGQ - Add the _find_distance() function used in previous
 commit.

---
 src/plugins/select/bluegene/ba_bgq/block_allocator.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/plugins/select/bluegene/ba_bgq/block_allocator.c b/src/plugins/select/bluegene/ba_bgq/block_allocator.c
index 59baacafea7..fec48acbeba 100644
--- a/src/plugins/select/bluegene/ba_bgq/block_allocator.c
+++ b/src/plugins/select/bluegene/ba_bgq/block_allocator.c
@@ -102,6 +102,9 @@ static bool _mp_used(ba_mp_t* ba_mp, int dim);
 /** */
 static bool _mp_out_used(ba_mp_t* ba_mp, int dim);
 
+/** */
+static uint16_t _find_distance(uint16_t start, uint16_t end, int dim);
+
 extern void ba_create_system()
 {
 	int a,x,y,z, i = 0, dim;
@@ -1660,3 +1663,11 @@ static bool _mp_out_used(ba_mp_t* ba_mp, int dim)
 	return false;
 }
 
+static uint16_t _find_distance(uint16_t start, uint16_t end, int dim)
+{
+	if (end < start)
+		return (((DIM_SIZE[dim]-1) - start) + end) * 4;
+	else
+		return (end - start) * 4;
+}
+
-- 
GitLab