Mercurial > hg > CbC > old > device
comparison mc-codegen.c @ 790:a26d87f93c65
i64 bitfiled
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 21 Nov 2010 23:03:37 +0900 |
parents | 9b1558a9151b |
children | 3622e3f561db |
comparison
equal
deleted
inserted
replaced
789:9b1558a9151b | 790:a26d87f93c65 |
---|---|
5527 | 5527 |
5528 /* | 5528 /* |
5529 make bit mask | 5529 make bit mask |
5530 MSB 1 2 3 4 .... 29 30 31 LSB | 5530 MSB 1 2 3 4 .... 29 30 31 LSB |
5531 */ | 5531 */ |
5532 extern unsigned | |
5533 make_mask(int from,int to) | |
5534 { | |
5535 unsigned mask = 0; | |
5536 unsigned bit = 1; | |
5537 int i; | |
5538 if (from<0||from>31) error(-1); | |
5539 for (i=31;from<=i;i--,bit<<=1) { | |
5540 if (i<=to) { | |
5541 mask |= bit; | |
5542 } | |
5543 } | |
5544 return mask; | |
5545 } | |
5546 | |
5532 extern unsigned long long | 5547 extern unsigned long long |
5533 make_mask(int from,int to) | 5548 make_mask_64(int from,int to) |
5534 { | 5549 { |
5535 unsigned long long mask = 0; | 5550 unsigned long long mask = 0; |
5536 unsigned long long bit = 1; | 5551 unsigned long long bit = 1; |
5537 int i; | 5552 int i; |
5538 if (from<0||from>63) error(-1); | 5553 if (from<0||from>63) error(-1); |