-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #538 from morinted/mac_keycode
Fix Mac OS X keyboard layout
- Loading branch information
Showing
7 changed files
with
548 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) 2016 Open Steno Project | ||
# See LICENSE.txt for details. | ||
|
||
|
||
def popcount_8(v): | ||
"""Population count for an 8 bit integer""" | ||
assert 0 <= v <= 255 | ||
v -= ((v >> 1) & 0x55555555) | ||
v = (v & 0x33333333) + ((v >> 2) & 0x33333333) | ||
return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24 | ||
|
||
|
||
def characters(string): | ||
"""Python 2.7 has narrow Unicode on Mac OS X and Windows""" | ||
|
||
encoded = string.encode('utf-32-be') # 4 bytes per character | ||
for char_start in xrange(0, len(encoded), 4): | ||
end = char_start + 4 | ||
character = encoded[char_start:end].decode('utf-32-be') | ||
yield character |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.