You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/06/22 05:25:13 UTC

[12/38] lucenenet git commit: API: Lucene.Net.Util.RamUsageEstimator: Added SizeOf() overloads for ulong, uint, and ushort

API: Lucene.Net.Util.RamUsageEstimator: Added SizeOf() overloads for ulong, uint, and ushort


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/5ebf735c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/5ebf735c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/5ebf735c

Branch: refs/heads/master
Commit: 5ebf735c8ff16ce11b8a1c012a4340f661722b75
Parents: a6b5a87
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sat Jun 17 13:56:34 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sat Jun 17 13:56:34 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net/Util/RamUsageEstimator.cs | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5ebf735c/src/Lucene.Net/Util/RamUsageEstimator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Util/RamUsageEstimator.cs b/src/Lucene.Net/Util/RamUsageEstimator.cs
index 5ae74a8..6dc5a14 100644
--- a/src/Lucene.Net/Util/RamUsageEstimator.cs
+++ b/src/Lucene.Net/Util/RamUsageEstimator.cs
@@ -349,7 +349,29 @@ namespace Lucene.Net.Util
             return AlignObjectSize((long)NUM_BYTES_ARRAY_HEADER + (long)NUM_BYTES_DOUBLE * arr.Length);
         }
 
-        // LUCENENET TODO: API - Add SizeOf() overloads for ulong, ushort, uint
+        /// <summary>
+        /// Returns the size in bytes of the <see cref="T:ulong[]"/> object. </summary>
+        [CLSCompliant(false)]
+        public static long SizeOf(ulong[] arr)
+        {
+            return AlignObjectSize((long)NUM_BYTES_ARRAY_HEADER + (long)NUM_BYTES_INT64 * arr.Length);
+        }
+
+        /// <summary>
+        /// Returns the size in bytes of the <see cref="T:uint[]"/> object. </summary>
+        [CLSCompliant(false)]
+        public static long SizeOf(uint[] arr)
+        {
+            return AlignObjectSize((long)NUM_BYTES_ARRAY_HEADER + (long)NUM_BYTES_INT32 * arr.Length);
+        }
+
+        /// <summary>
+        /// Returns the size in bytes of the <see cref="T:ushort[]"/> object. </summary>
+        [CLSCompliant(false)]
+        public static long SizeOf(ushort[] arr)
+        {
+            return AlignObjectSize((long)NUM_BYTES_ARRAY_HEADER + (long)NUM_BYTES_INT16 * arr.Length);
+        }
 
         /// <summary>
         /// Estimates the RAM usage by the given object. It will