From: boylesgj AT lion DOT cs DOT latrobe DOT edu DOT au (Gregary J Boyles) Newsgroups: comp.os.msdos.djgpp Subject: Help improving function sped needed. Date: 18 Feb 1997 13:54:52 GMT Organization: Comp.Sci & Comp.Eng, La Trobe Uni, Australia Lines: 80 Distribution: world Message-ID: <5eccbc$f31@lion.cs.latrobe.edu.au> NNTP-Posting-Host: lion.cs.latrobe.edu.au To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I have designed a text window class which is copied directly to video RAM after completion of output. Below is one of the functions of that class and it outputs a string to the window i.e. starting from character number 'FromStringPos' for 'Length' characters. The StringC class contains the operator function [] which allows indexing of the string from 1 to the length of the string. The window is stored as a 1D array of unsigned int's and the array indexes are calculated by the inline function ConvertIndex using the current window X and Y coordinates and the window width. The text attribute is stored as an unsigned int with the lower byte zeroed so all that needs to be done is to | the string character with the text attribute and copy it to the appropriate array element. The if statement, inside the for loop, allows for cursor CR/LF and window scrolling etc. It works fine except if you are writing numerous long strings to a large window in which case it becomes unacceptably slow. I.E. for (I=0;IWindowWidth) { // If the character cell was not on the last line. if (CursorY