Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. while (*s++ = ((*t & 0x60) == 0x40 ? *t ^ 0x20 : *t)) t++;

while (*s++ = ((*t & 0x60) == 0x40 ? *t ^ 0x20 : *t)) t++;

Scheduled Pinned Locked Moved The Lounge
rubyquestion
40 Posts 27 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    It turns a string to lower case? edit: that is, it copies a string to s as lower case (but I'm still not actually sure)

    N Offline
    N Offline
    NormDroid
    wrote on last edited by
    #14

    *t ^ 0x20 maybe upper

    Two heads are better than one.

    L 1 Reply Last reply
    0
    • R Rob Philpott

      Bingo!, Well done.

      Regards, Rob Philpott.

      N Offline
      N Offline
      NormDroid
      wrote on last edited by
      #15

      I just had the debugger out, cranking it through.

      Two heads are better than one.

      1 Reply Last reply
      0
      • N NormDroid

        *t ^ 0x20 maybe upper

        Two heads are better than one.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #16

        But it only xors with 0x20 if it's already upper case (or a non-ascii char between 0xC0 and 0xDF) Undeserved 2-vote.

        modified on Monday, August 30, 2010 12:28 PM

        1 Reply Last reply
        0
        • L Lost User

          It turns a string to lower case? edit: that is, it copies a string to s as lower case (but I'm still not actually sure)

          P Offline
          P Offline
          peterchen
          wrote on last edited by
          #17

          someone who knows his ASCII :)

          Agh! Reality! My Archnemesis![^]
          | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

          L 1 Reply Last reply
          0
          • P peterchen

            someone who knows his ASCII :)

            Agh! Reality! My Archnemesis![^]
            | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #18

            Well, to be honest, I did take a look at the ASCII table.. before that I wasn't sure enough of my answer to post it Undeserved 1-vote.

            modified on Monday, August 30, 2010 12:28 PM

            1 Reply Last reply
            0
            • R Rob Philpott

              It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

              Regards, Rob Philpott.

              M Offline
              M Offline
              Member 96
              wrote on last edited by
              #19

              Cause a developer to get fired? Or at least a stern talking to?


              Yesterday they said today was tomorrow but today they know better. - Poul Anderson

              P 1 Reply Last reply
              0
              • R Rob Philpott

                It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                Regards, Rob Philpott.

                J Offline
                J Offline
                Jonas Hammarberg
                wrote on last edited by
                #20

                Copying string, turning upper case into lower case...

                R 1 Reply Last reply
                0
                • R Rob Philpott

                  It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                  Regards, Rob Philpott.

                  H Offline
                  H Offline
                  hdjim
                  wrote on last edited by
                  #21

                  increment the address of s set the value of s to the value of t and increment t. the value of t is dependent on the if statement. AND the value of t with 0x60 and if bit 6 is set, make the value of s = the value of t exclusive ored with 32,otherwise set s to the value of t... then increment the address of t. do this until the value of s is not true.

                  modified on Monday, August 30, 2010 9:33 AM

                  1 Reply Last reply
                  0
                  • R Rob Philpott

                    It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                    Regards, Rob Philpott.

                    E Offline
                    E Offline
                    ehoagland66
                    wrote on last edited by
                    #22

                    I used to write my code like this until my boss beat me with stick and took my coffee cup :laugh:

                    A 1 Reply Last reply
                    0
                    • M Member 96

                      Cause a developer to get fired? Or at least a stern talking to?


                      Yesterday they said today was tomorrow but today they know better. - Poul Anderson

                      P Offline
                      P Offline
                      philcaetano
                      wrote on last edited by
                      #23

                      Trying to figure this out, will causes someone to lose more productive than the multi-monitor/multi-tasking debate. ;P

                      1 Reply Last reply
                      0
                      • E ehoagland66

                        I used to write my code like this until my boss beat me with stick and took my coffee cup :laugh:

                        A Offline
                        A Offline
                        Andreas Mertens
                        wrote on last edited by
                        #24

                        I remember using this technique for an assembly program I wrote many years ago. When I worked out what it was doing, it took a moment to realize why it look familiar... Andreas Mertens

                        1 Reply Last reply
                        0
                        • L Lost User

                          It turns a string to lower case? edit: that is, it copies a string to s as lower case (but I'm still not actually sure)

                          L Offline
                          L Offline
                          Larry G Grimes
                          wrote on last edited by
                          #25

                          It definitely returns a string with all lowercase characters.

                          M 1 Reply Last reply
                          0
                          • R Rob Philpott

                            It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                            Regards, Rob Philpott.

                            M Offline
                            M Offline
                            M i s t e r L i s t e r
                            wrote on last edited by
                            #26

                            wastes a lot of peoples time on this site ?

                            1 Reply Last reply
                            0
                            • R Rob Philpott

                              It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                              Regards, Rob Philpott.

                              T Offline
                              T Offline
                              tom1443
                              wrote on last edited by
                              #27

                              This looks like an job interview question, in which case I don't want the job.

                              1 Reply Last reply
                              0
                              • R Rob Philpott

                                It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                                Regards, Rob Philpott.

                                P Offline
                                P Offline
                                PHLIPH
                                wrote on last edited by
                                #28

                                Yeah, converts to lower case is right - but don't forget it also does '@' => '`', '[' => '{', '\' => '|', ']' => '}', '^' => '-', and '_' => del. Just felt the need to punctuate it. :)

                                1 Reply Last reply
                                0
                                • R Rob Philpott

                                  It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?

                                  Regards, Rob Philpott.

                                  N Offline
                                  N Offline
                                  neil hudson
                                  wrote on last edited by
                                  #29

                                  It corrupts strings with @ [ \ ] ^ and _ in them.

                                  Neil Hudson

                                  1 Reply Last reply
                                  0
                                  • J Jonas Hammarberg

                                    Copying string, turning upper case into lower case...

                                    R Offline
                                    R Offline
                                    Rosenne
                                    wrote on last edited by
                                    #30

                                    Only in America... I mean, only for US ASCII. :thumbsdown:

                                    J 1 Reply Last reply
                                    0
                                    • P Pete OHanlon

                                      Rob Philpott wrote:

                                      Any takers for what this gem does?

                                      Why that's obvious. It makes you hate the coder who spewed it into your source.

                                      I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

                                      My blog | My articles | MoXAML PowerToys | Onyx

                                      Y Offline
                                      Y Offline
                                      yoni at jefco
                                      wrote on last edited by
                                      #31

                                      I was going to say "Hopefully get someone sacked". Maybe a bit harsh on my part.

                                      1 Reply Last reply
                                      0
                                      • L Larry G Grimes

                                        It definitely returns a string with all lowercase characters.

                                        M Offline
                                        M Offline
                                        Matthew Barnett
                                        wrote on last edited by
                                        #32

                                        Larry G. Grimes wrote:

                                        It definitely returns a string with all lowercase characters.

                                        It'll change other characters too, such as '@' to '`'!

                                        1 Reply Last reply
                                        0
                                        • R Rosenne

                                          Only in America... I mean, only for US ASCII. :thumbsdown:

                                          J Offline
                                          J Offline
                                          Jonas Hammarberg
                                          wrote on last edited by
                                          #33

                                          Worked for ANSI to, albeit only the lower parts :rolleyes:

                                          R 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups