Search:

Type: Posts; User: wavering

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    1,381

    Sorenson, That was useful! By returning the...

    Sorenson,

    That was useful! By returning the pointer do you mean something like:



    #include <stdio.h>
    #include <string.h>

    char *change (){
  2. "ASM is not going to be faster than simple bit...

    "ASM is not going to be faster than simple bit shifting. If it is, it's minutely so:"

    I can only answer for my compiler ( MSVC++ ) and having done careful timings I find that if I need to do TWO...
  3. Replies
    10
    Views
    1,718

    There is a standard C function for powers, so for...

    There is a standard C function for powers, so for square root use:

    answer = pow(number,(double)(1)/2);

    For tenth root it would be:

    answer = pow(number,(double)(1)/10);

    Not sure if you...
  4. "What is inline asm?" Ah! Right. I sort of...

    "What is inline asm?"

    Ah! Right. I sort of assumed it was obvious but very little is obvious until you know it.

    Inline asm is a facility in the C language where you can incorporate Assembly...
  5. Replies
    9
    Views
    4,168

    The reason most widely quoted is: "If you learn C...

    The reason most widely quoted is: "If you learn C you can get a good job as a programer"

    To me this is the worst reason to do anything. I love C because it has enormous flexibility and you can get...
  6. Thread: Inline asm

    by wavering
    Replies
    2
    Views
    2,429

    Many thanks Bubba! See you there! From a quick...

    Many thanks Bubba!

    See you there! From a quick glance it looks just the job ...
  7. Here is how VC++6 disassembles: 403: ...

    Here is how VC++6 disassembles:



    403: code[liner][1] >>= 13;
    //Shift 13 "bits" to extreme right ..

    004027C7 mov edx,dword ptr [ebp-0Ch]
    004027CA and ...
  8. I own over 30 books on C bought over many years -...

    I own over 30 books on C bought over many years - intending one day to read them! In total I guess they contain about twenty ( at the most ) pages on inline C. I guess it is not a very fashionable...
  9. Thread: Inline asm

    by wavering
    Replies
    2
    Views
    2,429

    Inline asm

    I realise that I bang on rather about inline asm but it is the only reason I have bothered to learn C. Or, to be more precise, I have learned C because some things are just too laborious to do in...
  10. Nutshell You can use asm in C very simply. To...

    Nutshell

    You can use asm in C very simply. To take an example from the program I am working on.

    C Instruction:

    liner++;

    We all know this increases the value of liner by one. When I look...
  11. I actually use a single short ( ie 16 bit )...

    I actually use a single short ( ie 16 bit ) integer to store six pieces of information in my program. To extract them I shift left then right rather than use a mask ( whether it is quicker I don't...
  12. Replies
    12
    Views
    1,816

    Thanks Shiro I take your point but what I was...

    Thanks Shiro

    I take your point but what I was trying to do was avoid a situation where I have to test for all sorts of possible conditions, thereby slowing my ( time critical ) program down. I...
  13. Replies
    12
    Views
    1,816

    This has solved a problem for me, many thanks. I...

    This has solved a problem for me, many thanks. I need to carry on if my prog divides by zero and this works ... on MSVC++ compiler ( But I am writing in C - works on both C and C++)



    #include...
  14. Replies
    22
    Views
    4,388

    Thanks everybody for your help. I don't know...

    Thanks everybody for your help.

    I don't know how many people are interested in speed of execution and/or inline asm but for those who are, here is a part disassembly of the switch statement...
  15. Replies
    22
    Views
    4,388

    Thanks sayeh >Use the 'register' keyword on...

    Thanks sayeh

    >Use the 'register' keyword on your variables.

    Yup - done that already

    >Another thing is to make all your variables 32-bits (even if you only count from 1-10). This way the...
  16. Replies
    22
    Views
    4,388

    Unregistered, Firstly, concerning the original...

    Unregistered,

    Firstly, concerning the original code I posted I should have pointed out that each of the eight cases of the switch IS visited as j%8 ( ie j Mod 8 ) cycles between 0 to 7 and back...
  17. Replies
    22
    Views
    4,388

    Salem and Unregistered Thanks for the replies....

    Salem and Unregistered

    Thanks for the replies. The code example is NOT part of a real program as it achieves absolutely nothing! It specifically featured "switch()" as this is a crucial element in...
  18. Replies
    22
    Views
    4,388

    Many thanks Salem - especially for pointing out...

    Many thanks Salem - especially for pointing out my crass error in not setting j at zero. First part of code should read:

    long j = 0;

    My revised timings using QuickC 2.51 after correcting the...
  19. Replies
    22
    Views
    4,388

    Thanks Shiro. My question re XP was badly worded...

    Thanks Shiro. My question re XP was badly worded but was ( maybe ) clear from what went before. It should have read:

    Q1. Why is there no speed increase when I run the program on a machine which...
  20. Replies
    22
    Views
    4,388

    Many thanks for the answers. Before re-writing...

    Many thanks for the answers. Before re-writing for a 32 bit windows compiler I would be very grateful if people could compile the test program below and see how long it takes on various systems. I'm...
  21. Replies
    22
    Views
    4,388

    Questions on Speed of Execution

    I am very new to C but have written a program in C with quite a lot of inline assembly code as speed is crucial. I am using QuickC version 2.51 which is a very old DOS based program but run in an...
  22. Replies
    2
    Views
    3,098

    Many thanks Sayeh, Yes - I use 50 lines of asm...

    Many thanks Sayeh,
    Yes - I use 50 lines of asm because it is quicker not because I have nothing else to do!

    I take your comments re the cache but I am just going on timings and what I have done...
  23. Replies
    2
    Views
    3,098

    Inline asm - I love it!

    Having derived great benefit from this board ( mostly via the search facility ) while I learn C I thought I would write something on inline asm. I started using C because I needed to rewite an...
  24. Thanks Stoned_Coder. Am using DOS based ( QuickC...

    Thanks Stoned_Coder. Am using DOS based ( QuickC 2.51 ) system. Have only just looked at your post and have meanwhile solved problem as below:

    gotoxy(int x,int y) //Declare Function gotoxy
    ...
  25. Thanks C_Coder but I am trying to write an ultra...

    Thanks C_Coder but I am trying to write an ultra fast routine ( so anything looping is out ) which puts updates into various locations on the screen as things change.

    I need to jump instantly to...
Results 1 to 25 of 26
Page 1 of 2 1 2