Skip to content

Commit

Permalink
lemon signed->unsigned hashing for #142
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Jun 19, 2017
1 parent 4033297 commit 1429bd4
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions c/parsing/lemon_report.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ void print_stack_union(
int maxdtlength; /* Maximum length of any ".datatype" field. */
char *stddt; /* Standardized name for a datatype */
int i,j; /* Loop counters */
int hash; /* For hashing the name of a type */
unsigned hash; /* For hashing the name of a type */
char *name; /* Name of the parser */

/* Allocate and initialize types[] and allocate stddt[] */
Expand Down Expand Up @@ -677,7 +677,7 @@ void print_stack_union(
stddt[j] = 0;
hash = 0;
for(j=0; stddt[j]; j++){
hash = hash*53 + stddt[j];
hash = hash*53 + (unsigned)stddt[j];
}
hash = (hash & 0x7fffffff)%arraysize;
while (types[hash]) {
Expand Down
6 changes: 3 additions & 3 deletions c/parsing/lemon_state_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ struct config *b;
static int statehash(a)
struct config *a;
{
int h=0;
unsigned h=0;
while (a) {
h = h*571 + a->rp->index*37 + a->dot;
h = h*571 + (unsigned)a->rp->index*37 + (unsigned)a->dot;
a = a->bp;
}
return h;
return (int)h;
}

/* Allocate a new state structure */
Expand Down
4 changes: 2 additions & 2 deletions c/parsing/lemon_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include "lemon_string.h"

int strhash(char *x) {
int h = 0;
unsigned h = 0;
while (*x) h = h*13 + *(x++);
return h;
return (int)h;
}

// ================================================================
Expand Down
6 changes: 3 additions & 3 deletions c/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ airable:
! mld/mlh stats1 regex cookbook/10min examples

! termcvt -I
!!! aux-list -> main help; dox too
! aux-list -> main help; dox too

* UT unhex

! faqent/cookbook/more:
mlr termcvt --cr2lf foo.csv.cr > foo.csv

! !autoreconf doc note w/ as-of-5.2.0 caveat

* reg_test/run --mlrexec flag

* across-all/regex x stats1 / many verbs
Expand Down
2 changes: 1 addition & 1 deletion doc/manpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -2228,7 +2228,7 @@



2017-06-14 MILLER(1)
2017-06-19 MILLER(1)
</pre>
</div>
<p/>
Expand Down
2 changes: 1 addition & 1 deletion doc/manpage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2035,4 +2035,4 @@ SEE ALSO



2017-06-14 MILLER(1)
2017-06-19 MILLER(1)
4 changes: 2 additions & 2 deletions doc/mlr.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: mlr
.\" Author: [see the "AUTHOR" section]
.\" Generator: ./mkman.rb
.\" Date: 2017-06-14
.\" Date: 2017-06-19
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2017-06-14" "\ \&" "\ \&"
.TH "MILLER" "1" "2017-06-19" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 1429bd4

Please sign in to comment.