Roel
Roel

Reputation: 19642

Way in Visual Studio to display integers as bit array

Is there a way in Visual Studio, either through it's native features or a plugin, to show an integer/long/char variable in the debugger window as a bit array? For example, rather than seeing 5 or 0x5 I'd like to see 101. As a bonus feature I'd like to see them left-padded with the correct amount of zeroes, so that the total width of the field is equal to the actual amount of bits the type is.

(I know I can convert with calc.exe but that's a pain when debugging bit manipulations).

Upvotes: 2

Views: 799

Answers (2)

Francis Boivin
Francis Boivin

Reputation: 255

If you're using managed C++ you can write a simple Visualizer just like the built-in ones for char* (to see the string as html, xml or the raw string).

Too bad it's not supported for native (I guess it's for security reasons)

Upvotes: 0

Dewfy
Dewfy

Reputation: 23634

Here complete list of format specifiers but no bits there. http://msdn.microsoft.com/en-us/library/75w45ekt(VS.80).aspx

By the way, it is simple to convert hex (x format) or octal (o format) in mind. Just place before eyes simple table of octal or hex symbols. After the day you'll on fly convert 5A->1011010

Upvotes: 2

Related Questions