 |
- Author:
- gim (IP: 83.29.218.119)
- Timestamp:
- 07/25/07 09:35:30 (6 years ago)
- Comment:
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PythonChallenge3da
| v3 |
v4 |
|
| 84 | 84 | char lastlet; |
|---|
| 85 | 85 | }}} |
|---|
| 86 | | 'current' will hold actually computed 'hash' (bitmask), and 'lastlet' will hold latest letter 'in the middle'. |
|---|
| | 86 | ''current'' will hold actually computed ''hash'' (bitmask), and ''lastlet'' will hold latest letter ''in the middle''. |
|---|
| 87 | 87 | |
|---|
| 88 | 88 | {{{ |
|---|
| 91 | 91 | current <<= 2, current |= getcase(letter); |
|---|
| 92 | 92 | }}} |
|---|
| 93 | | Precompute 'hash' for first 8 characters, by simply shifting our variable by two bits, and adding the proper bits. |
|---|
| | 93 | Precompute ''hash'' for first 8 characters, by simply shifting our variable by two bits, and adding the proper bits. |
|---|
| 94 | 94 | |
|---|
| 95 | | Later process the rest of the line, remembering current 'middle letter'. Because in our hash we represent every letter as two bits we need to binary-and only the last 18 bits, that's what 0x3ffff is there for. |
|---|
| | 95 | Later process the rest of the line, remembering current ''middle letter''. Because in our hash we represent every letter as two bits we need to binary-and only the last 18 bits, that's what 0x3ffff is there for. |
|
 |
 |
|
 |
Copyright © 2006-2013 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic