![]() |
|
|
|||||||
![]() |
PERL - machine dependent left shift results |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
On a 32 bit machine, ~0<<32 gives 11111111111111111111111111111111 (I was
expecting 0) (~0<<31)<<1 gives 0. I was trying ~(~0<<$size) to create a mask of $size ones. ((1<<$size) -1) was what I tried first but it also failed for the same reason, I guess. I like that in verilog I can just say {$size{1'b1}} I know I can use Math::BigInt, but I still wonder what the rationale is behind the first example failing. EC easily_confused |
|
|
|
|
#2 |
|
Posts: n/a
|
reposted on comp.lang.perl.misc
please respond there "easily_confused" <> wrote in message news:003ff6be$0$32523$... > On a 32 bit machine, ~0<<32 gives 11111111111111111111111111111111 (I was > expecting 0) > > (~0<<31)<<1 gives 0. > > I was trying ~(~0<<$size) to create a mask of $size ones. > > ((1<<$size) -1) was what I tried first but it also failed for the same > reason, I guess. > > I like that in verilog I can just say {$size{1'b1}} > > I know I can use Math::BigInt, but I still wonder what the rationale is > behind the first example failing. > > EC > > > easily_confused |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| java applet and accesing results from a database | Ayesha | General Help Related Topics | 0 | 08-12-2009 04:15 PM |
| pcAnywhere and Brother fax machine on same phoen line | bem522 | Software | 0 | 07-20-2007 04:20 PM |
| Evidence Mounts That The Vote Was Hacked | Jas | DVD Video | 272 | 12-27-2004 09:22 PM |
| "The biggest scandal to ever hit American politics" | Jas | DVD Video | 149 | 12-05-2004 02:47 PM |
| Re: Can't login to XP Pro machine | Gary | A+ Certification | 3 | 09-22-2004 10:17 PM |