diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-12-17 11:37:54 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-12-17 11:37:54 +0100 |
commit | 1e5b58007da3be94755b017004cd5fe484ccbed7 (patch) | |
tree | 0b285c48f3151add05cf7c8dfbb960646c7df49f /csim/util.c | |
parent | f91d7484c8d5af62dff97eb9ce5a5ac85aba2005 (diff) | |
download | SystDigit-Projet-1e5b58007da3be94755b017004cd5fe484ccbed7.tar.gz SystDigit-Projet-1e5b58007da3be94755b017004cd5fe484ccbed7.zip |
Tabs to spaces ; deleted Caml simulator (useless anyways)
Diffstat (limited to 'csim/util.c')
-rw-r--r-- | csim/util.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/csim/util.c b/csim/util.c index c815e8e..ac8bdc3 100644 --- a/csim/util.c +++ b/csim/util.c @@ -1,45 +1,45 @@ /* - Système Digital - 2013-2014 - Alex AUVOLAT + Système Digital + 2013-2014 + Alex AUVOLAT - util.c Various utility functions used elsewhere + util.c Various utility functions used elsewhere */ #include "sim.h" int pow2(int exp) { - return (1 << exp); + return (1 << exp); } t_value read_bool(FILE *stream, t_value *mask) { - t_value r = 0; - t_value pow = 1; + t_value r = 0; + t_value pow = 1; - char c; - if (mask != NULL) *mask = 0; + char c; + if (mask != NULL) *mask = 0; - for(;;) { - fscanf(stream, "%c", &c); - if (c == '1') { - r |= pow; - } else if (c != '0') { - break; - } - if (mask != NULL) (*mask) |= pow; + for(;;) { + fscanf(stream, "%c", &c); + if (c == '1') { + r |= pow; + } else if (c != '0') { + break; + } + if (mask != NULL) (*mask) |= pow; - pow *= 2; - } + pow *= 2; + } - return r; + return r; } int is_prefix(const char *prefix, const char *str) { - while (*prefix) { - if (*prefix != *str) return 0; - prefix++; - str++; - } - return 1; + while (*prefix) { + if (*prefix != *str) return 0; + prefix++; + str++; + } + return 1; } |