14,242,790 members

# C / C++ / MFC

 Re: MFC Picture Control image size. Richard MacCutchan18-Jul-19 4:03 Richard MacCutchan 18-Jul-19 4:03
 Algorithm Problem(C++ solution) nirvikprantor12-Jul-19 5:05 nirvikprantor 12-Jul-19 5:05
 Re: Algorithm Problem(C++ solution) OriginalGriff12-Jul-19 5:10 OriginalGriff 12-Jul-19 5:10
 Re: Algorithm Problem(C++ solution) Joe Woodbury12-Jul-19 10:02 Joe Woodbury 12-Jul-19 10:02
 Re: Algorithm Problem(C++ solution) Stefan_Lang15-Jul-19 2:05 Stefan_Lang 15-Jul-19 2:05
 Re: Algorithm Problem(C++ solution) Gerry Schmitz15-Jul-19 8:14 Gerry Schmitz 15-Jul-19 8:14
 Overflow check on integer multiplication in C ? Hans9999-Jul-19 2:01 Hans999 9-Jul-19 2:01
 Re: Overflow check on integer multiplication in C ? Daniel Pfeffer9-Jul-19 3:10 Daniel Pfeffer 9-Jul-19 3:10
 One way would be to perform the multiplication as a double-precision operation, and then examine the high word. For unsigned values (in pseudocode): ```// HI_HALF - returns the upper N/2 bits of an N-bit integer // LO_HALF - returns the lower N/2 bits of an N-bit integer // MAKE_DIGIT - combines two N/2-bit values to make an N-bit integer // multiply a DIGIT a by a DIGIT b, returning a two-DIGIT result // a, b must be unsigned DIGIT alow = LO_HALF(a) DIGIT ahigh = HI_HALF(a) DIGIT blow = LO_HALF(b) DIGIT bhigh = HI_HALF(b) DIGIT carry DIGIT accumulator DIGIT result[4] accumulator = alow * blow carry = HI_HALF(accumulator) result[0] = LO_HALF(accumulator) accumulator = alow * bhigh + carry result[1] = LO_HALF(accumulator) result[2] = HI_HALF(accumulator) accumulator = ahigh * blow + result[1] result[1] = LO_HALF(accumulator) carry = HI_HALF(accumulator) accumulator = ahigh * bhigh + result[2] + carry result[2] = LO_HALF(accumulator) result[3] = HI_HALF(accumulator) // combine result[3] and result[2] into 1 DIGIT // combine result[1] and result[0] into 1 DIGIT return MAKE_DIGIT(result[3], result[2]), MAKE_DIGIT(result[1], result[0])``` Note that many optimizations may be performed on the above code; it is laid out like this for easy comprehension. For the operation a * b, if the high digit is non-zero, the result has overflowed For the operation a * b / c, if the high DIGIT of (a * b) >= c, then the entire operation will overflow. Signed values are left as an exercise for the student. Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.
 Re: Overflow check on integer multiplication in C ? Joe Woodbury9-Jul-19 7:41 Joe Woodbury 9-Jul-19 7:41
 Re: Overflow check on integer multiplication in C ? leon de boer10-Jul-19 3:35 leon de boer 10-Jul-19 3:35
 Re: Overflow check on integer multiplication in C ? CPallini10-Jul-19 4:57 CPallini 10-Jul-19 4:57
 I have created a Wrapper but while calling a function from C# its moving to my Lib file and giving below error andy solution? Member 143147593-Jul-19 22:14 Member 14314759 3-Jul-19 22:14
 Re: I have created a Wrapper but while calling a function from C# its moving to my Lib file and giving below error andy solution? leon de boer4-Jul-19 2:39 leon de boer 4-Jul-19 2:39
 "crosslinking " - different architecture libraries - is is possible? Vaclav_1-Jul-19 10:54 Vaclav_ 1-Jul-19 10:54
 Re: "crosslinking " - different architecture libraries - is is possible? Richard MacCutchan1-Jul-19 20:56 Richard MacCutchan 1-Jul-19 20:56
 Re: "crosslinking " - different architecture libraries - is is possible? leon de boer2-Jul-19 5:03 leon de boer 2-Jul-19 5:03
 Created .Dll from and .ocx using C++/CLI but interop is not loading in C# Member 143147591-Jul-19 3:16 Member 14314759 1-Jul-19 3:16
 Return From DoModal with RadioButton ForNow30-Jun-19 4:50 ForNow 30-Jun-19 4:50
 Re: Return From DoModal with RadioButton Victor Nijegorodov30-Jun-19 6:43 Victor Nijegorodov 30-Jun-19 6:43
 Re: Return From DoModal with RadioButton `Randor` 30-Jun-19 7:13 `Randor` 30-Jun-19 7:13
 Re: Return From DoModal with RadioButton ForNow30-Jun-19 7:53 ForNow 30-Jun-19 7:53
 Re: Return From DoModal with RadioButton `Randor` 30-Jun-19 8:08 `Randor` 30-Jun-19 8:08
 Re: Return From DoModal with RadioButton ForNow30-Jun-19 9:43 ForNow 30-Jun-19 9:43
 Re: Return From DoModal with RadioButton `Randor` 30-Jun-19 14:22 `Randor` 30-Jun-19 14:22
 Re: Return From DoModal with RadioButton ForNow30-Jun-19 16:24 ForNow 30-Jun-19 16:24
 Last Visit: 22-Jul-19 10:41     Last Update: 22-Jul-19 10:41 Refresh 1234567891011 Next »

General    News    Suggestion    Question    Bug    Answer    Joke    Praise    Rant    Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.