![]() |
| Register | Login | |||||
|
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
|
| | |||
| 0 users currently in Programming. |
| Acmlm's Board - I3 Archive - Programming - VB6 - Overflow Error with 32760? |
New poll | | ![]() |
| Add to favorites | Next newer thread | Next older thread |
| User | Post | ||
|
Sukasa Birdo Not quite as active as before. Xkeeper supporter Xk > ||bass I IP Banned myself! Twice! Since: 11-17-05 From: Somewhere over there Last post: 5908 days Last view: 5907 days |
| ||
| So, yeah, I'm working on a piece of code, and a bug gave me a wron goffset for another section of code in a decompression routine. I was using a counter for an array variable bIn(), and got this, where lpA = 8 and bin(9) = 145, and bIn(10) = 0, and lpC and lpB are unimportant (lpC was 0 FYI, and lpB was 18). The error was in the section "( (bIn(lpA+1) * 256) + bIn(lpa + 2) + lpC)":
bOut(lpB) = bOut( (bIn(lpA+1) * 256) + bIn(lpa + 2) + lpC) lpA, lpB, and lpC were all long variables, and bIn() and bOut() were all byte variables. So, bIn(lpA+1) = 145, and for 145*256 it gave me an overflow error. Any help as to why it did so? I then executed "Debug.Print 145*256" In the immediate pane, and ALso got an overflow error. Help? |
|||
|
never-obsolete Paragoomba Since: 05-14-06 From: AZ Last post: 5909 days Last view: 5909 days |
| ||
Since the two operands are integers, vb assumes that the variable you are assigning the value to is also gonna be an integer. Cast the operands to long first then assign.
do that to any integer constants in your algorithm |
|||
|
Sukasa Birdo Not quite as active as before. Xkeeper supporter Xk > ||bass I IP Banned myself! Twice! Since: 11-17-05 From: Somewhere over there Last post: 5908 days Last view: 5907 days |
| ||
| Ah, thanks. I was wondering why the heck VB was doing that. |
| Add to favorites | Next newer thread | Next older thread |
| Acmlm's Board - I3 Archive - Programming - VB6 - Overflow Error with 32760? |
| ![]() |