-
Notifications
You must be signed in to change notification settings - Fork 15
/
Endian.natvis
35 lines (31 loc) · 1.74 KB
/
Endian.natvis
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="endianness::Endian<*>">
<Intrinsic Name="arrayView" Category="Method" Expression="reinterpret_cast<unsigned char*>(&value)" />
<Intrinsic Name="byteAt" Category="Method" Expression="a < sizeof($T1) ? arrayView()[a] : 0">
<Parameter Name="a" Type="int" />
</Intrinsic>
<Intrinsic Name="byteSh" Category="Method" Expression="a < sizeof($T1) ? (byteAt(a)<<8*(sizeof($T1)-1-a)) : 0">
<Parameter Name="a" Type="int" />
</Intrinsic>
<Intrinsic Name="swaped" Category="Method" Expression="byteSh(0)|byteSh(1)|byteSh(2)|byteSh(3)|byteSh(4)|byteSh(5)|byteSh(6)|byteSh(7)|byteSh(8)" />
<Intrinsic Name="isStr" Category="Method" Expression="value>0&&!(byteAt(0)<32||byteAt(1)<32||byteAt(2)<32||byteAt(3)<32||sizeof($T1)>4)" />
<Intrinsic Name="isBigLittle" Category="Method" Expression="$T2==utils::endian::little || $T2==utils::endian::big" />
<Intrinsic Name="native" Category="Method" Expression="$T2==utils::endian::native ? value : swaped()" />
<DisplayString IncludeView="str">
{arrayView(),[sizeof($T1)]na}
</DisplayString>
<DisplayString IncludeView="native">
{native()}
</DisplayString>
<DisplayString Condition="!isBigLittle()">
{value} {{{(utils::endian)$T2,en} {value,h} {*this,view(str)}}}
</DisplayString>
<DisplayString Condition="isStr()">
{{{(utils::endian)$T2,en} {value,h} {*this,view(str)}}}
</DisplayString>
<DisplayString>
{*this,view(native)} {{{(utils::endian)$T2,en} {value,h}}}
</DisplayString>
</Type>
</AutoVisualizer>