Lucene.Net.Core.Util.RamUsageEstimator: added SizeOf() overload for byte[] and marked the sbyte[] overload CLSCompliant(false)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/7cb60642 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/7cb60642 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/7cb60642 Branch: refs/heads/api-work Commit: 7cb60642bc80aacc605e8257237a93b9bb4a8c5e Parents: 0ef5798 Author: Shad Storhaug <[email protected]> Authored: Sun Feb 5 19:23:51 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sun Feb 5 19:23:51 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Util/RamUsageEstimator.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7cb60642/src/Lucene.Net.Core/Util/RamUsageEstimator.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/RamUsageEstimator.cs b/src/Lucene.Net.Core/Util/RamUsageEstimator.cs index 0faeba0..4171d22 100644 --- a/src/Lucene.Net.Core/Util/RamUsageEstimator.cs +++ b/src/Lucene.Net.Core/Util/RamUsageEstimator.cs @@ -272,7 +272,16 @@ namespace Lucene.Net.Util /// <summary> /// Returns the size in bytes of the byte[] object. </summary> - public static long SizeOf(sbyte[] arr) // LUCENENET TODO: can we change to byte ? it doesn't use the values in the array anyway + // LUCENENET specific overload for CLS compliance + public static long SizeOf(byte[] arr) + { + return AlignObjectSize((long)NUM_BYTES_ARRAY_HEADER + arr.Length); + } + + /// <summary> + /// Returns the size in bytes of the sbyte[] object. </summary> + [CLSCompliant(false)] + public static long SizeOf(sbyte[] arr) { return AlignObjectSize((long)NUM_BYTES_ARRAY_HEADER + arr.Length); }
