Menu

Rexx binary function issue

Sergey
2015-04-03
2015-04-03
  • Sergey

    Sergey - 2015-04-03

    Hi! I never before use rexx built-in binary function.
    Today I try to use built-in function BITOR and see
    say bitor(8,4) / == '<' /
    say x2b(8) / == '1000' /
    say x2b(4) / == '0100' /
    say bitor('1000'b,'0100'b) / == '0C'x as one char /
    say bitor(x2b(8),x2b(4)) / == '1100'b /

    It's drive me crazy.
    I don't understand why bitor(8,4) returns char '<'

     
    • Rick McGuire

      Rick McGuire - 2015-04-03

      The bit functions operate on characters. In ASCII, 8 is '38'x and 4 is
      '34'x. Oring those bits together produces '3c'x, which is the character
      '<'.

      Rick

      On Fri, Apr 3, 2015 at 8:31 AM, Sergey hogges@users.sf.net wrote:

      Hi! I never before use rexx built-in binary function.
      Today I try to use built-in function BITOR and see
      say bitor(8,4) / == '<' /
      say x2b(8) / == '1000' /
      say x2b(4) / == '0100' /
      say bitor('1000'b,'0100'b) / == '0C'x as one char /
      say bitor(x2b(8),x2b(4)) / == '1100'b /

      It's drive me crazy.
      I don't understand why bitor(8,4) returns char '<'


      Rexx binary function issue


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/oorexx/discussion/408477/>

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/>

       
    • Jon Wolfers

      Jon Wolfers - 2015-04-03

      Hi Sergey

      You are bitoring the STRING '8' with the STRING '4'
      You are using ascii so
      '8' is '38'x = '00111000'b
      '4' is '34'x = '00110100'b
      ORing them gives '00111100'b = '3c'x which in ascii is the character '<'

      hope that helps,

      Jon

      On 3 April 2015 at 13:31, Sergey hogges@users.sf.net wrote:

      Hi! I never before use rexx built-in binary function.
      Today I try to use built-in function BITOR and see
      say bitor(8,4) / == '<' /
      say x2b(8) / == '1000' /
      say x2b(4) / == '0100' /
      say bitor('1000'b,'0100'b) / == '0C'x as one char /
      say bitor(x2b(8),x2b(4)) / == '1100'b /

      It's drive me crazy.
      I don't understand why bitor(8,4) returns char '<'


      Rexx binary function issue
      https://sourceforge.net/p/oorexx/discussion/408477/thread/debf01bb/?limit=25#db54


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/oorexx/discussion/408477/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • Sergey

    Sergey - 2015-04-03

    Thank You very much.

     

Log in to post a comment.