bitwise ANDing in navision

jksjks Member Posts: 277
edited 2005-07-25 in Navision Attain
Hi all,

I want to do bitwise ANDing in navision using c\al. How can i do that?

Is there any bitwise operator in navision?

Thanks for any help.

Comments

  • ara3nara3n Member Posts: 9,256
    Since this the bitwise operation for AND. It is pretty simple to write your own function that takes two parameters compares them and returns the result.

    0 1 0 1 0 1 1 0
    0 0 1 1 0 0 1 0
    0 0 0 1 0 0 1 0
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • aciaci Member Posts: 41
    Someone posted a C/AL function here:

    http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=4162

    If you want a faster approach, make a DLL and call it from within Navision.
  • kinekine Member Posts: 12,562
    The example is too complicated/. There is simple function:
    BitAnd(A : Integer;B : Integer) : Integer
    Var
      Pos : integer;
      Tmp : integer;
    
    begin
      Pos :=1;
      Tmp := 0;
      FOR i:=1 TO 32 DO BEGIN   //count of bits in integer
        IF ((A MOD 2) =1) AND ((B MOD 2)=1) THEN
          Tmp := Tmp + Pos;
        Pos := Pos * 2;
        A := A DIV 2;
        B := B DIV 2;
      END;
      EXIT(Tmp);
    end;
    
    BitOr(A : Integer;B : Integer) : Integer
    Var
      Pos : integer;
      Tmp : integer;
    
    begin
      Pos :=1;
      Tmp := 0;
      FOR i:=1 TO 32 DO BEGIN   //count of bits in integer
        IF ((A MOD 2) =1) OR ((B MOD 2)=1) THEN
          Tmp := Tmp + Pos;
        Pos := Pos * 2;
        A := A DIV 2;
        B := B DIV 2;
      END;
      EXIT(Tmp);
    end;
    
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.