Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Macro To Ge...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 18 Topic 9553 of 9831
Post > Topic >>

Re: Macro To Generate Inline Assembly

by Carl Barron <cbarron413@[EMAIL PROTECTED] > Apr 30, 2008 at 04:13 AM

In article
<cd16a402-7f07-4367-ad9d-45297e2c0325@[EMAIL PROTECTED]
>, Le
Chaud Lapin <jaibuduvin@[EMAIL PROTECTED]
> wrote:

> 
> There is also the matter of superfluous instructions being  added even
> to the inline function,
     All this depends on the compiler and what it does with inline and
asm:)
    inline std::uint32_t f()
    {
    const std::uint32_t a= ~0;
    const std::uint16_t b= ~0;
    return a/b;
    }

    produces:
       lis  r2,1         // load high word of r2 with 1
       add r2,r2,1 // r2 = r2 + 1

  no pre-call code and only a move to memory on exit since I tested it
witn
    void g() {std::uint_32_t x = f();}

    so what is the point??  low level code depends on the compiler and
definitely the hardware involved.
      BTW in 10 years I have written only one assembler routine and it
was to swap bytes converting the endianness of a binary file of 16 bit
ints, using a processor specific instruction that did this 32bits at a
time.

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 18 Posts in Topic:
Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-27 07:29:36 
Re: Macro To Generate Inline Assembly
=?ISO-8859-1?Q?Daniel_Kr=  2008-04-27 12:39:09 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-27 12:39:05 
Re: Macro To Generate Inline Assembly
Tony Delroy <tony_in_d  2008-04-28 02:13:23 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-28 16:06:49 
Re: Macro To Generate Inline Assembly
Mathias Gaunard <loufo  2008-04-28 20:34:54 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-28 23:23:12 
Re: Macro To Generate Inline Assembly
=?ISO-8859-1?Q?Daniel_Kr=  2008-04-29 10:35:49 
Re: Macro To Generate Inline Assembly
Francis Glassborow <fr  2008-04-29 10:43:23 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-29 17:38:48 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-29 17:42:22 
Re: Macro To Generate Inline Assembly
galathaea <galathaea@[  2008-04-29 18:29:42 
Re: Macro To Generate Inline Assembly
Carl Barron <cbarron41  2008-04-30 04:13:23 
Re: Macro To Generate Inline Assembly
Mathias Gaunard <loufo  2008-04-30 04:13:22 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-30 10:42:39 
Re: Macro To Generate Inline Assembly
John Nagle <nagle@[EMA  2008-05-03 06:13:27 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-05-03 16:10:43 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-05-03 16:13:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:45:47 CDT 2008.