Index: funcs/func_math.c =================================================================== --- funcs/func_math.c (revision 67592) +++ funcs/func_math.c (working copy) @@ -53,6 +53,8 @@ POWFUNCTION, SHLEFTFUNCTION, SHRIGHTFUNCTION, + BITWISEANDFUNCTION, + BITWISEORFUNCTION, GTFUNCTION, LTFUNCTION, GTEFUNCTION, @@ -114,6 +116,12 @@ } else if ((op = strchr(mvalue1, '^'))) { iaction = POWFUNCTION; *op = '\0'; + } else if ((op = strchr(mvalue1, '&'))) { + iaction = BITWISEANDFUNCTION; + *op = '\0'; + } else if ((op = strchr(mvalue1, '|'))) { + iaction = BITWISEORFUNCTION; + *++op = '\0'; } else if ((op = strchr(mvalue1, '>'))) { iaction = GTFUNCTION; *op = '\0'; @@ -237,6 +245,20 @@ ftmp = (inum1 >> inum2); break; } + case BITWISEANDFUNCTION: + { + int inum1 = fnum1; + int inum2 = fnum2; + ftmp = (inum1 & inum2); + break; + } + case BITWISEORFUNCTION: + { + int inum1 = fnum1; + int inum2 = fnum2; + ftmp = (inum1 | inum2); + break; + } case GTFUNCTION: ast_copy_string(buf, (fnum1 > fnum2) ? "TRUE" : "FALSE", len); break; @@ -278,7 +300,7 @@ .synopsis = "Performs Mathematical Functions", .syntax = "MATH([,])", .desc = "Perform calculation on number1 to number2. Valid ops are: \n" - " +,-,/,*,%,<<,>>,^,<,>,>=,<=,==\n" + " +,-,/,*,%,<<,>>,^,&,|,<,>,>=,<=,==\n" "and behave as their C equivalents.\n" " - wanted type of result:\n" " f, float - float(default)\n"