From 1ee96fc3e975e92e0430f57acd098064681601e3 Mon Sep 17 00:00:00 2001 From: morkt Date: Tue, 1 Dec 2015 11:24:48 +0400 Subject: [PATCH] (Binary): added RotR and RotL methods. --- GameRes/Utility.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/GameRes/Utility.cs b/GameRes/Utility.cs index 55616d5f..f7c53052 100644 --- a/GameRes/Utility.cs +++ b/GameRes/Utility.cs @@ -104,6 +104,18 @@ namespace GameRes.Utility { return GetCString (data, index, length_limit, Encodings.cp932); } + + public static uint RotR (uint v, int count) + { + count &= 0x1F; + return v >> count | v << (32-count); + } + + public static uint RotL (uint v, int count) + { + count &= 0x1F; + return v << count | v >> (32-count); + } } public static class BigEndian