dol: initial dol commit
[jump.git] / dol / src / dol / visitor / cell / lib / spu / common.cpp
diff --git a/dol/src/dol/visitor/cell/lib/spu/common.cpp b/dol/src/dol/visitor/cell/lib/spu/common.cpp
new file mode 100644 (file)
index 0000000..df56fc8
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * common.cpp
+ *
+ *  Created on: Feb 27, 2009
+ *      Author: lschor
+ */
+
+#include "../common.h"
+
+/**
+ Round a number to the alignment of the Cell
+ */
+uint32_t roundDMA(uint32_t number) {
+       if (number > 16)
+               if (number % 16 == 0)
+                       return number;
+               else
+                       return number + 16 - (number % 16);
+       else if (number > 8)
+               return 16;
+       else if (number > 4)
+               return 8;
+       else if (number > 2)
+               return 4;
+       else if (number > 1)
+               return 2;
+       else
+               return 1;
+}