about summary refs log tree commit diff
path: root/prism/src/rotate.rs
diff options
context:
space:
mode:
authorgennyble <gen@nyble.dev>2023-09-11 20:09:33 -0500
committergennyble <gen@nyble.dev>2023-09-11 20:09:33 -0500
commitd451c304b76ce525cf9dfc9e2e2fee13f1b0f135 (patch)
treef040d58331f0e6861e946d930b4d3645926a6dfb /prism/src/rotate.rs
parent22b07838e7d83998bc9d46e219410d1431527687 (diff)
downloadlri-rs-d451c304b76ce525cf9dfc9e2e2fee13f1b0f135.tar.gz
lri-rs-d451c304b76ce525cf9dfc9e2e2fee13f1b0f135.zip
ahh2
Diffstat (limited to 'prism/src/rotate.rs')
-rw-r--r--prism/src/rotate.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/prism/src/rotate.rs b/prism/src/rotate.rs
new file mode 100644
index 0000000..82f29d1
--- /dev/null
+++ b/prism/src/rotate.rs
@@ -0,0 +1,11 @@
+pub fn rotate_180<T: Copy>(data: &mut [T]) {
+	let mut rat = vec![data[0]; data.len()];
+
+	for (idx, px) in data.chunks(3).rev().enumerate() {
+		rat[idx * 3] = px[0];
+		rat[idx * 3 + 1] = px[1];
+		rat[idx * 3 + 2] = px[2];
+	}
+
+	data.copy_from_slice(&rat);
+}