AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
BitManipulator.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using System;
5 
6 namespace HoloToolkit.Unity
7 {
11  public class BitManipulator
12  {
13  Int32 mask;
14  Int32 shift;
15 
16  public BitManipulator(Int32 mask, Int32 shift)
17  {
18  this.mask = mask;
19  this.shift = shift;
20  }
21 
22  public Int32 GetBitsValue(Int32 input)
23  {
24  return (input & mask) >> shift;
25  }
26 
27  public void SetBits(ref Int32 value, Int32 bitsValue)
28  {
29  Int32 iT = bitsValue << shift;
30  iT = iT & mask;
31  value = value | iT;
32  }
33  }
34 }
void SetBits(ref Int32 value, Int32 bitsValue)
Helper class for bit manipulation.
BitManipulator(Int32 mask, Int32 shift)