Convert 32-bit signed integer to 64-bit integer while preserving the exact bitsHow can I convert a character to a integer in Python, and viceversa?Converting an integer to a string in PHPConvert integer to hexadecimal and back againConvert string to integer type in Go?Convert boolean result into number/integerHow to convert integer to string in C?How to convert unsigned integer to signed integer without OverflowExceptionGetting bits from a packed wordVB.net Integer and Short conversion, GetMessagePos()Conversion of 2 bit signed integer to 8 bit signed integer in MATLAB
Adjective for 'made of pus' or 'corrupted by pus' or something of something of pus
Can a successful book series let the bad guy win?
How can a valley surrounded by mountains be fertile and rainy?
Simple logic puzzle
Sharing referee/AE report online to point out a grievous error in refereeing
Losing queen and then winning the game
I need help with pasta
How do we separate rules of logic from non-logical constraints?
Translation of the Sator Square
Is it okay to submit a paper from a master's thesis without informing the advisor?
Are Valenar elves and Aereni elves different races of elves?
Missing root certificates on Windows Server 2016 (fresh install)
Plotting with Precision
Could human civilization live 150 years in a nuclear-powered aircraft carrier colony without resorting to mass killing/ cannibalism?
Most elegant way to write a one-shot 'if'
Comparing exit code: unary operator expected
Why do movie directors use brown tint on Mexico cities?
Why wasn't EBCDIC designed with contiguous alphanumeric characters?
How do I tell the reader that my character is autistic in Fantasy?
Security Patch SUPEE-11155 - Possible issues?
Could you fall off a planet if it was being accelerated by engines?
Converting Geographic Coordinates into Lambert2008 coordinates
Why wasn't ASCII designed with a contiguous alphanumeric character order?
Preferred word for "preferred", "target", "chosen" in end user support documentation
Convert 32-bit signed integer to 64-bit integer while preserving the exact bits
How can I convert a character to a integer in Python, and viceversa?Converting an integer to a string in PHPConvert integer to hexadecimal and back againConvert string to integer type in Go?Convert boolean result into number/integerHow to convert integer to string in C?How to convert unsigned integer to signed integer without OverflowExceptionGetting bits from a packed wordVB.net Integer and Short conversion, GetMessagePos()Conversion of 2 bit signed integer to 8 bit signed integer in MATLAB
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a 32-bit value that is stored in the VB.Net type Integer (i.e. Int32.) I am only interested in the bits - not the numerical value. Sometimes the 32nd bit is a one which is interpreted as a negative number. My goal is to reverse the actual bits. My original data is encoded into bits right-to-left (LSB right-most) and is read back in left-to-right (MSB left-most.) I am adapting someone else's code and design. One thought I had was maybe to convert to a long temporarily but I don't know how to do that and preserve the 32nd bit correctly.
Public Shared Function ReverseBits32(ByVal n As Integer) As Integer
Dim result As Integer = 0
For i As Integer = 0 To 32 - 1
result = result * 2 + n Mod 2
n = n >> 1 'n Or 2
Next
Return result
End Function
vb.net types type-conversion
|
show 3 more comments
I have a 32-bit value that is stored in the VB.Net type Integer (i.e. Int32.) I am only interested in the bits - not the numerical value. Sometimes the 32nd bit is a one which is interpreted as a negative number. My goal is to reverse the actual bits. My original data is encoded into bits right-to-left (LSB right-most) and is read back in left-to-right (MSB left-most.) I am adapting someone else's code and design. One thought I had was maybe to convert to a long temporarily but I don't know how to do that and preserve the 32nd bit correctly.
Public Shared Function ReverseBits32(ByVal n As Integer) As Integer
Dim result As Integer = 0
For i As Integer = 0 To 32 - 1
result = result * 2 + n Mod 2
n = n >> 1 'n Or 2
Next
Return result
End Function
vb.net types type-conversion
1
If you are interested in just the bit, why are you using signed integer?
– the_lotus
Mar 25 at 14:50
I started with a sample application that originally worked with 8-bit values but was implemented using 32-bit integers. That makes sense as that will have much higher performance. My use requires 32-bit values. It would greatly delay my project if I tried to convert the data types at this point. I'll edit the question to more precisely explain my requirement.
– user339468
Mar 25 at 14:55
It won't let me edit. So I need a function to completely reverse the bits in a 32 bit signed integer. I'm tripping over the 32nd bit when it is a one, thus making it a negative number.
– user339468
Mar 25 at 14:57
So what you actually need is just a way to reverse the bits in a 32 bit integer, and that's what you're having trouble with? You don't necessarily need to go to 64 bits at all, as long as there's some other way of reversing the 32 bits?
– Steven Doggart
Mar 25 at 15:06
Yes, sorry I wasn't clearer.
– user339468
Mar 25 at 15:10
|
show 3 more comments
I have a 32-bit value that is stored in the VB.Net type Integer (i.e. Int32.) I am only interested in the bits - not the numerical value. Sometimes the 32nd bit is a one which is interpreted as a negative number. My goal is to reverse the actual bits. My original data is encoded into bits right-to-left (LSB right-most) and is read back in left-to-right (MSB left-most.) I am adapting someone else's code and design. One thought I had was maybe to convert to a long temporarily but I don't know how to do that and preserve the 32nd bit correctly.
Public Shared Function ReverseBits32(ByVal n As Integer) As Integer
Dim result As Integer = 0
For i As Integer = 0 To 32 - 1
result = result * 2 + n Mod 2
n = n >> 1 'n Or 2
Next
Return result
End Function
vb.net types type-conversion
I have a 32-bit value that is stored in the VB.Net type Integer (i.e. Int32.) I am only interested in the bits - not the numerical value. Sometimes the 32nd bit is a one which is interpreted as a negative number. My goal is to reverse the actual bits. My original data is encoded into bits right-to-left (LSB right-most) and is read back in left-to-right (MSB left-most.) I am adapting someone else's code and design. One thought I had was maybe to convert to a long temporarily but I don't know how to do that and preserve the 32nd bit correctly.
Public Shared Function ReverseBits32(ByVal n As Integer) As Integer
Dim result As Integer = 0
For i As Integer = 0 To 32 - 1
result = result * 2 + n Mod 2
n = n >> 1 'n Or 2
Next
Return result
End Function
vb.net types type-conversion
vb.net types type-conversion
edited Mar 25 at 18:18
user339468
asked Mar 25 at 14:48
user339468user339468
1013 bronze badges
1013 bronze badges
1
If you are interested in just the bit, why are you using signed integer?
– the_lotus
Mar 25 at 14:50
I started with a sample application that originally worked with 8-bit values but was implemented using 32-bit integers. That makes sense as that will have much higher performance. My use requires 32-bit values. It would greatly delay my project if I tried to convert the data types at this point. I'll edit the question to more precisely explain my requirement.
– user339468
Mar 25 at 14:55
It won't let me edit. So I need a function to completely reverse the bits in a 32 bit signed integer. I'm tripping over the 32nd bit when it is a one, thus making it a negative number.
– user339468
Mar 25 at 14:57
So what you actually need is just a way to reverse the bits in a 32 bit integer, and that's what you're having trouble with? You don't necessarily need to go to 64 bits at all, as long as there's some other way of reversing the 32 bits?
– Steven Doggart
Mar 25 at 15:06
Yes, sorry I wasn't clearer.
– user339468
Mar 25 at 15:10
|
show 3 more comments
1
If you are interested in just the bit, why are you using signed integer?
– the_lotus
Mar 25 at 14:50
I started with a sample application that originally worked with 8-bit values but was implemented using 32-bit integers. That makes sense as that will have much higher performance. My use requires 32-bit values. It would greatly delay my project if I tried to convert the data types at this point. I'll edit the question to more precisely explain my requirement.
– user339468
Mar 25 at 14:55
It won't let me edit. So I need a function to completely reverse the bits in a 32 bit signed integer. I'm tripping over the 32nd bit when it is a one, thus making it a negative number.
– user339468
Mar 25 at 14:57
So what you actually need is just a way to reverse the bits in a 32 bit integer, and that's what you're having trouble with? You don't necessarily need to go to 64 bits at all, as long as there's some other way of reversing the 32 bits?
– Steven Doggart
Mar 25 at 15:06
Yes, sorry I wasn't clearer.
– user339468
Mar 25 at 15:10
1
1
If you are interested in just the bit, why are you using signed integer?
– the_lotus
Mar 25 at 14:50
If you are interested in just the bit, why are you using signed integer?
– the_lotus
Mar 25 at 14:50
I started with a sample application that originally worked with 8-bit values but was implemented using 32-bit integers. That makes sense as that will have much higher performance. My use requires 32-bit values. It would greatly delay my project if I tried to convert the data types at this point. I'll edit the question to more precisely explain my requirement.
– user339468
Mar 25 at 14:55
I started with a sample application that originally worked with 8-bit values but was implemented using 32-bit integers. That makes sense as that will have much higher performance. My use requires 32-bit values. It would greatly delay my project if I tried to convert the data types at this point. I'll edit the question to more precisely explain my requirement.
– user339468
Mar 25 at 14:55
It won't let me edit. So I need a function to completely reverse the bits in a 32 bit signed integer. I'm tripping over the 32nd bit when it is a one, thus making it a negative number.
– user339468
Mar 25 at 14:57
It won't let me edit. So I need a function to completely reverse the bits in a 32 bit signed integer. I'm tripping over the 32nd bit when it is a one, thus making it a negative number.
– user339468
Mar 25 at 14:57
So what you actually need is just a way to reverse the bits in a 32 bit integer, and that's what you're having trouble with? You don't necessarily need to go to 64 bits at all, as long as there's some other way of reversing the 32 bits?
– Steven Doggart
Mar 25 at 15:06
So what you actually need is just a way to reverse the bits in a 32 bit integer, and that's what you're having trouble with? You don't necessarily need to go to 64 bits at all, as long as there's some other way of reversing the 32 bits?
– Steven Doggart
Mar 25 at 15:06
Yes, sorry I wasn't clearer.
– user339468
Mar 25 at 15:10
Yes, sorry I wasn't clearer.
– user339468
Mar 25 at 15:10
|
show 3 more comments
1 Answer
1
active
oldest
votes
If you had a method to reverse the bits of a byte you could apply it four times to the bytes of an integer. A little research finds Bit Twiddling Hacks.
Module Module1
Sub ShowBits(a As Integer)
Dim aa = BitConverter.GetBytes(a)
Console.WriteLine(String.Join(" ", aa.Select(Function(b) Convert.ToString(b, 2).PadLeft(8, "0"c))))
End Sub
Function ReverseBits(b As Byte) As Byte
' From https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
Dim c = CULng(b)
Return CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)
End Function
Function ReverseBits(a As Integer) As Integer
Dim bb = BitConverter.GetBytes(a)
Dim cc(3) As Byte
For i = 0 To 3
cc(3 - i) = ReverseBits(bb(i))
Next
Return BitConverter.ToInt32(cc, 0)
End Function
Sub Main()
Dim y = -762334566
ShowBits(y)
y = ReverseBits(y)
ShowBits(y)
Console.ReadLine()
End Sub
End Module
Output from test value:
10011010 10110010 10001111 11010010
01001011 11110001 01001101 01011001
I used the "no 64-bit" method because it is written for a language where arithmetic overflow is ignored - the methods using 64-bit operations rely on that but it is not the default for VB.NET.
This will take me some time to puzzle out but I assume "CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)" is handling the sign bit? This looks promising.
– user339468
Mar 25 at 19:02
A Byte is unsigned.BitConverter.GetBytesgets the raw bytes without any interpretation. So the sign bit does not come into it :)
– Andrew Morton
Mar 25 at 19:05
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340483%2fconvert-32-bit-signed-integer-to-64-bit-integer-while-preserving-the-exact-bits%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you had a method to reverse the bits of a byte you could apply it four times to the bytes of an integer. A little research finds Bit Twiddling Hacks.
Module Module1
Sub ShowBits(a As Integer)
Dim aa = BitConverter.GetBytes(a)
Console.WriteLine(String.Join(" ", aa.Select(Function(b) Convert.ToString(b, 2).PadLeft(8, "0"c))))
End Sub
Function ReverseBits(b As Byte) As Byte
' From https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
Dim c = CULng(b)
Return CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)
End Function
Function ReverseBits(a As Integer) As Integer
Dim bb = BitConverter.GetBytes(a)
Dim cc(3) As Byte
For i = 0 To 3
cc(3 - i) = ReverseBits(bb(i))
Next
Return BitConverter.ToInt32(cc, 0)
End Function
Sub Main()
Dim y = -762334566
ShowBits(y)
y = ReverseBits(y)
ShowBits(y)
Console.ReadLine()
End Sub
End Module
Output from test value:
10011010 10110010 10001111 11010010
01001011 11110001 01001101 01011001
I used the "no 64-bit" method because it is written for a language where arithmetic overflow is ignored - the methods using 64-bit operations rely on that but it is not the default for VB.NET.
This will take me some time to puzzle out but I assume "CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)" is handling the sign bit? This looks promising.
– user339468
Mar 25 at 19:02
A Byte is unsigned.BitConverter.GetBytesgets the raw bytes without any interpretation. So the sign bit does not come into it :)
– Andrew Morton
Mar 25 at 19:05
add a comment |
If you had a method to reverse the bits of a byte you could apply it four times to the bytes of an integer. A little research finds Bit Twiddling Hacks.
Module Module1
Sub ShowBits(a As Integer)
Dim aa = BitConverter.GetBytes(a)
Console.WriteLine(String.Join(" ", aa.Select(Function(b) Convert.ToString(b, 2).PadLeft(8, "0"c))))
End Sub
Function ReverseBits(b As Byte) As Byte
' From https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
Dim c = CULng(b)
Return CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)
End Function
Function ReverseBits(a As Integer) As Integer
Dim bb = BitConverter.GetBytes(a)
Dim cc(3) As Byte
For i = 0 To 3
cc(3 - i) = ReverseBits(bb(i))
Next
Return BitConverter.ToInt32(cc, 0)
End Function
Sub Main()
Dim y = -762334566
ShowBits(y)
y = ReverseBits(y)
ShowBits(y)
Console.ReadLine()
End Sub
End Module
Output from test value:
10011010 10110010 10001111 11010010
01001011 11110001 01001101 01011001
I used the "no 64-bit" method because it is written for a language where arithmetic overflow is ignored - the methods using 64-bit operations rely on that but it is not the default for VB.NET.
This will take me some time to puzzle out but I assume "CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)" is handling the sign bit? This looks promising.
– user339468
Mar 25 at 19:02
A Byte is unsigned.BitConverter.GetBytesgets the raw bytes without any interpretation. So the sign bit does not come into it :)
– Andrew Morton
Mar 25 at 19:05
add a comment |
If you had a method to reverse the bits of a byte you could apply it four times to the bytes of an integer. A little research finds Bit Twiddling Hacks.
Module Module1
Sub ShowBits(a As Integer)
Dim aa = BitConverter.GetBytes(a)
Console.WriteLine(String.Join(" ", aa.Select(Function(b) Convert.ToString(b, 2).PadLeft(8, "0"c))))
End Sub
Function ReverseBits(b As Byte) As Byte
' From https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
Dim c = CULng(b)
Return CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)
End Function
Function ReverseBits(a As Integer) As Integer
Dim bb = BitConverter.GetBytes(a)
Dim cc(3) As Byte
For i = 0 To 3
cc(3 - i) = ReverseBits(bb(i))
Next
Return BitConverter.ToInt32(cc, 0)
End Function
Sub Main()
Dim y = -762334566
ShowBits(y)
y = ReverseBits(y)
ShowBits(y)
Console.ReadLine()
End Sub
End Module
Output from test value:
10011010 10110010 10001111 11010010
01001011 11110001 01001101 01011001
I used the "no 64-bit" method because it is written for a language where arithmetic overflow is ignored - the methods using 64-bit operations rely on that but it is not the default for VB.NET.
If you had a method to reverse the bits of a byte you could apply it four times to the bytes of an integer. A little research finds Bit Twiddling Hacks.
Module Module1
Sub ShowBits(a As Integer)
Dim aa = BitConverter.GetBytes(a)
Console.WriteLine(String.Join(" ", aa.Select(Function(b) Convert.ToString(b, 2).PadLeft(8, "0"c))))
End Sub
Function ReverseBits(b As Byte) As Byte
' From https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
Dim c = CULng(b)
Return CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)
End Function
Function ReverseBits(a As Integer) As Integer
Dim bb = BitConverter.GetBytes(a)
Dim cc(3) As Byte
For i = 0 To 3
cc(3 - i) = ReverseBits(bb(i))
Next
Return BitConverter.ToInt32(cc, 0)
End Function
Sub Main()
Dim y = -762334566
ShowBits(y)
y = ReverseBits(y)
ShowBits(y)
Console.ReadLine()
End Sub
End Module
Output from test value:
10011010 10110010 10001111 11010010
01001011 11110001 01001101 01011001
I used the "no 64-bit" method because it is written for a language where arithmetic overflow is ignored - the methods using 64-bit operations rely on that but it is not the default for VB.NET.
answered Mar 25 at 18:26
Andrew MortonAndrew Morton
16.5k6 gold badges38 silver badges54 bronze badges
16.5k6 gold badges38 silver badges54 bronze badges
This will take me some time to puzzle out but I assume "CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)" is handling the sign bit? This looks promising.
– user339468
Mar 25 at 19:02
A Byte is unsigned.BitConverter.GetBytesgets the raw bytes without any interpretation. So the sign bit does not come into it :)
– Andrew Morton
Mar 25 at 19:05
add a comment |
This will take me some time to puzzle out but I assume "CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)" is handling the sign bit? This looks promising.
– user339468
Mar 25 at 19:02
A Byte is unsigned.BitConverter.GetBytesgets the raw bytes without any interpretation. So the sign bit does not come into it :)
– Andrew Morton
Mar 25 at 19:05
This will take me some time to puzzle out but I assume "CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)" is handling the sign bit? This looks promising.
– user339468
Mar 25 at 19:02
This will take me some time to puzzle out but I assume "CByte((((c * &H802UL And &H22110UL) Or (c * &H8020UL And &H88440UL)) * &H10101UL >> 16) And &HFFUL)" is handling the sign bit? This looks promising.
– user339468
Mar 25 at 19:02
A Byte is unsigned.
BitConverter.GetBytes gets the raw bytes without any interpretation. So the sign bit does not come into it :)– Andrew Morton
Mar 25 at 19:05
A Byte is unsigned.
BitConverter.GetBytes gets the raw bytes without any interpretation. So the sign bit does not come into it :)– Andrew Morton
Mar 25 at 19:05
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340483%2fconvert-32-bit-signed-integer-to-64-bit-integer-while-preserving-the-exact-bits%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
If you are interested in just the bit, why are you using signed integer?
– the_lotus
Mar 25 at 14:50
I started with a sample application that originally worked with 8-bit values but was implemented using 32-bit integers. That makes sense as that will have much higher performance. My use requires 32-bit values. It would greatly delay my project if I tried to convert the data types at this point. I'll edit the question to more precisely explain my requirement.
– user339468
Mar 25 at 14:55
It won't let me edit. So I need a function to completely reverse the bits in a 32 bit signed integer. I'm tripping over the 32nd bit when it is a one, thus making it a negative number.
– user339468
Mar 25 at 14:57
So what you actually need is just a way to reverse the bits in a 32 bit integer, and that's what you're having trouble with? You don't necessarily need to go to 64 bits at all, as long as there's some other way of reversing the 32 bits?
– Steven Doggart
Mar 25 at 15:06
Yes, sorry I wasn't clearer.
– user339468
Mar 25 at 15:10