Results 1 to 3 of 3

Thread: [2.0] [C#]CDQ - Convert Double to Quad (386+)?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    [2.0] [C#]CDQ - Convert Double to Quad (386+)?

    I am wondering how exactly CDQ would work in C#. Anyone know a C# equivalent?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] [C#]CDQ - Convert Double to Quad (386+)?

    What does a processor instruction have to do with a high-level language like C#?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: [2.0] [C#]CDQ - Convert Double to Quad (386+)?

    Something like this...

    Code:
        ulong CDQ(uint d)
        {
            if((d & 0x80000000) != 0)
                return 0xffffffff00000000 | (ulong)d; //sign extend 1
            else
                return (ulong)d;    //sign extend 0 (this is implicit)
        }
    In fact since C# is so much higher-level than ASM, the above would be virtually identical to the implementation of the MOVSE (move with sign extend) opcode.
    I don't live here any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width