Skip to content
Snippets Groups Projects
Commit eb613b05 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra
Browse files

Complain if used for sizes above system word size.

parent bddb1615
No related merge requests found
...@@ -202,6 +202,12 @@ int main(int argc, char** argv) { ...@@ -202,6 +202,12 @@ int main(int argc, char** argv) {
return 1; return 1;
} }
if (size > sizeof(eb_data_t)) {
fprintf(stderr, "%s: local Etherbone library only supports %s-bit operations.\n",
program, width_str[(sizeof(eb_data_t)<<1) - 1]);
return 1;
}
/* How big can the data be? */ /* How big can the data be? */
mask = ~(eb_data_t)0; mask = ~(eb_data_t)0;
mask >>= (sizeof(eb_data_t)-size)*8; mask >>= (sizeof(eb_data_t)-size)*8;
......
...@@ -197,6 +197,12 @@ int main(int argc, char** argv) { ...@@ -197,6 +197,12 @@ int main(int argc, char** argv) {
return 1; return 1;
} }
if (size > sizeof(eb_data_t)) {
fprintf(stderr, "%s: local Etherbone library only supports %s-bit operations.\n",
program, width_str[(sizeof(eb_data_t)<<1) - 1]);
return 1;
}
/* How big can the data be? */ /* How big can the data be? */
mask = ~(eb_data_t)0; mask = ~(eb_data_t)0;
mask >>= (sizeof(eb_data_t)-size)*8; mask >>= (sizeof(eb_data_t)-size)*8;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment