mirror of
https://github.com/Queercon/QC14-Badge-Webview.git
synced 2025-08-20 13:23:36 -07:00
extract bit array
This commit is contained in:
parent
7c54126c69
commit
2149eb6e13
1 changed files with 14 additions and 1 deletions
|
@ -180,9 +180,17 @@ namespace qcbadge.Controllers
|
||||||
//Need to convert the int to a bit array
|
//Need to convert the int to a bit array
|
||||||
String curIconArrStr = qcData.Substring(8, 10);
|
String curIconArrStr = qcData.Substring(8, 10);
|
||||||
System.Diagnostics.Debug.WriteLine(curIconArrStr);
|
System.Diagnostics.Debug.WriteLine(curIconArrStr);
|
||||||
ulong curIconArr = Convert.ToUInt64(curIconArrStr, 16);
|
long curIconArr = Convert.ToInt64(curIconArrStr, 16);
|
||||||
System.Diagnostics.Debug.WriteLine(curIconArr);
|
System.Diagnostics.Debug.WriteLine(curIconArr);
|
||||||
|
|
||||||
|
bool[] bitSet = new bool[40];
|
||||||
|
|
||||||
|
for(int i = 0; i < 40; i++)
|
||||||
|
{
|
||||||
|
bitSet[i] = IsBitSet(curIconArr, i);
|
||||||
|
System.Diagnostics.Debug.WriteLine(bitSet[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return StatusCode(200);
|
return StatusCode(200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -199,5 +207,10 @@ namespace qcbadge.Controllers
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsBitSet(long b, int pos)
|
||||||
|
{
|
||||||
|
return (b & (1 << pos)) != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue