Click here to Skip to main content
13,894,165 members

C / C++ / MFC

 
GeneralRe: MFC DDX_Radio causes debug assertion failure when DoDataExchange is called Pin
janaswamy uday30-Mar-18 4:37
memberjanaswamy uday30-Mar-18 4:37 
GeneralRe: MFC DDX_Radio causes debug assertion failure when DoDataExchange is called Pin
Victor Nijegorodov30-Mar-18 6:29
memberVictor Nijegorodov30-Mar-18 6:29 
GeneralRe: MFC DDX_Radio causes debug assertion failure when DoDataExchange is called Pin
janaswamy uday30-Mar-18 7:42
memberjanaswamy uday30-Mar-18 7:42 
GeneralRe: MFC DDX_Radio causes debug assertion failure when DoDataExchange is called Pin
Richard Andrew x6430-Mar-18 15:11
professionalRichard Andrew x6430-Mar-18 15:11 
SuggestionRe: MFC DDX_Radio causes debug assertion failure when DoDataExchange is called Pin
Jochen Arndt30-Mar-18 22:17
mveJochen Arndt30-Mar-18 22:17 
GeneralRe: MFC DDX_Radio causes debug assertion failure when DoDataExchange is called Pin
janaswamy uday1-Apr-18 21:05
memberjanaswamy uday1-Apr-18 21:05 
QuestionHow to map a matrix index to a memory location Pin
Leif Simon Goodwin29-Mar-18 1:26
memberLeif Simon Goodwin29-Mar-18 1:26 
AnswerRe: How to map a matrix index to a memory location Pin
Jochen Arndt29-Mar-18 2:39
mveJochen Arndt29-Mar-18 2:39 
The performance of integer multiplications depend on the used CPU architecture and generation.

With most x86 and compatible CPUs integer multiplications are 2 - 4 times slower than additions which can be usually ignored. Using a lookup table will be then not significantly faster or even slower.

However, with other (mainly RISC) CPU's, the operation can be up to 40 times slower than additions.

Quote:
The quickest way I can think of is to use a look up table
The quickest way is using a shift operation because that is executed on registers while a lookup table requires loading from memory.

Just compare the methods (in pseudo code):
; Classic method
load r1, x
mul r1, total_number_of_columns
add r1, y

; Shift
load r1, x
shl r1, shift_count
add r1, y

; Lookup table
load r1, x
; Assuming item size is a power of 2
; Otherwise a multiplication is used here!
shl r1, sizeof(item)
; EDIT: Must be of course according to the table item size
shl r1, TABLE_ITEM_SIZE_SHIFT
load r1, [lookup_table + r1]
add r1, y
Note that some of the above operations might require two assembly instructions (especially on RISC CPU's) when operations can be only performed on registers and not with memory addresses.

modified 29-Mar-18 9:00am.

GeneralRe: How to map a matrix index to a memory location Pin
Leif Simon Goodwin29-Mar-18 3:12
memberLeif Simon Goodwin29-Mar-18 3:12 
GeneralRe: How to map a matrix index to a memory location Pin
harold aptroot29-Mar-18 3:44
memberharold aptroot29-Mar-18 3:44 
AnswerRe: How to map a matrix index to a memory location Pin
Daniel Pfeffer29-Mar-18 5:06
professionalDaniel Pfeffer29-Mar-18 5:06 
QuestionWhat is the best tool to find C++ Memory issues Pin
ptr_Electron29-Mar-18 1:06
memberptr_Electron29-Mar-18 1:06 
AnswerRe: What is the best tool to find C++ Memory issues Pin
Leif Simon Goodwin29-Mar-18 1:28
memberLeif Simon Goodwin29-Mar-18 1:28 
GeneralRe: What is the best tool to find C++ Memory issues Pin
ptr_Electron30-Mar-18 10:12
memberptr_Electron30-Mar-18 10:12 
QuestionMemory allocated out side of try and Delete in finally Pin
ptr_Electron28-Mar-18 23:46
memberptr_Electron28-Mar-18 23:46 
AnswerRe: Memory allocated out side of try and Delete in finally Pin
Jochen Arndt29-Mar-18 0:17
mveJochen Arndt29-Mar-18 0:17 
GeneralRe: Memory allocated out side of try and Delete in finally Pin
ptr_Electron29-Mar-18 1:05
memberptr_Electron29-Mar-18 1:05 
GeneralRe: Memory allocated out side of try and Delete in finally Pin
Jochen Arndt29-Mar-18 1:44
mveJochen Arndt29-Mar-18 1:44 
Questionerror C2143: syntax error: missing ':' before 'constant' Pin
ForNow27-Mar-18 15:53
memberForNow27-Mar-18 15:53 
QuestionRe: error C2143: syntax error: missing ':' before 'constant' Pin
David Crow27-Mar-18 16:47
memberDavid Crow27-Mar-18 16:47 
AnswerRe: error C2143: syntax error: missing ':' before 'constant' Pin
ForNow27-Mar-18 16:52
memberForNow27-Mar-18 16:52 
GeneralRe: error C2143: syntax error: missing ':' before 'constant' Pin
Peter_in_278027-Mar-18 18:13
professionalPeter_in_278027-Mar-18 18:13 
GeneralRe: error C2143: syntax error: missing ':' before 'constant' Pin
ForNow28-Mar-18 14:50
memberForNow28-Mar-18 14:50 
GeneralRe: error C2143: syntax error: missing ':' before 'constant' Pin
Victor Nijegorodov27-Mar-18 21:18
memberVictor Nijegorodov27-Mar-18 21:18 
GeneralRe: error C2143: syntax error: missing ':' before 'constant' Pin
ForNow28-Mar-18 0:31
memberForNow28-Mar-18 0:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

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


Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190306.1 | Last Updated 15 Mar 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid