Skip to content

Commit

Permalink
Change ! to ~, as that's what it really is.
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Oct 6, 2014
1 parent d80591c commit 7d873b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion raddb/mods-available/expr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# precedence.
#
# It also allows unary negation: -1
# And logical invert: !1
# And twos complement: ~1
#
# All calculations are done on signed 63-bit integers.
# e.g. int64_t. This should be sufficient for all normal
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rlm_expr/rlm_expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ static bool get_number(REQUEST *request, char const **string, int64_t *answer)
while (isspace((int) *p)) p++;

/*
* !1 == 0xff...ffe
* ~1 == 0xff...ffe
*/
if (*p == '!') {
if (*p == '~') {
invert = true;
p++;
}
Expand Down
4 changes: 2 additions & 2 deletions src/tests/keywords/expr
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ if ("%{expr: 1 + 2 * (&Tmp-Integer-1 + &Tmp-Integer-2)}" != 15) {
}
}

if ("%{expr: 1 & !1}" != 0) {
if ("%{expr: 1 & ~1}" != 0) {
update reply {
Filter-Id := "fail-6"
}
}

if ("%{expr: 1 & !2}" != 1) {
if ("%{expr: 1 & ~2}" != 1) {
update reply {
Filter-Id := "fail-7"
}
Expand Down

0 comments on commit 7d873b6

Please sign in to comment.