I hereby claim:
- I am edmccard on github.
- I am edmccard (https://keybase.io/edmccard) on keybase.
- I have a public key whose fingerprint is 0855 D9C3 8F15 6515 CB52 2F90 2DC9 326E 2C17 B22F
To claim this, I am signing this object:
| trait Expectation<T> { | |
| fn expected(self, msg: &str) -> T; | |
| } | |
| impl<T> Expectation<T> for Option<T> { | |
| fn expected(self, msg: &str) -> T { | |
| match self { | |
| Some(val) => val, | |
| _ => expectation_failed(msg), | |
| } |
| ; SIMTEST.ASM | |
| ; | |
| ; If execution reaches pc = 0x54, all is well | |
| ; If execution reaches 0x50, SREG was incorrect | |
| ; If execution reaches 0x52, result (in r16) was incorrect | |
| ; NOTE: pc is byte address (like gcc-avr uses) | |
| ; On failure, r19 holds the number of the first failed test | |
| ; set SP to 0x00ff | |
| ldi r16, 0xff |
| func checkOverflow(result, op1, op2 uint8) bool { | |
| // (op1 ^ op2) & 0x80: zero if both operands had the same sign bit | |
| // (op1 ^ result) & 0x80: non-zero if the result is a different sign | |
| // from the operands | |
| // So it returns true if either: | |
| // both operands are positive but the result is negative | |
| // or vice-versa | |
| return (((op1 ^ op2) & 0x80) == 0) && (((op1 ^ result) & 0x80) != 0) | |
| } |
I hereby claim:
To claim this, I am signing this object:
| (if (fboundp 'python-beginning-of-string) | |
| ;; python.el | |
| (defun er--python-string-start-pos () | |
| "Returns character address of start of string, nil if not inside. " | |
| (let ((pt (point))) | |
| (save-excursion | |
| ;; python-beginning-of-string returns the current | |
| ;; position if point is not in a string, so we have | |
| ;; to check if point moved, and if not, we check if | |
| ;; we weren't already on the first quote of a string |
| (when (fboundp 'py-mark-block-or-clause) | |
| ;; Duplicating this for python.el would require a bit of work. | |
| (defun er/mark-x-python-compound-statement () | |
| "Mark the current compound statement (if, while, for, try) and all clauses." | |
| (interactive) | |
| (let ((secondary-re | |
| (save-excursion | |
| (py-mark-block-or-clause) | |
| (cond ((looking-at "if\\|for\\|while\\|else\\|elif") "else\\|elif") | |
| ((looking-at "try\\|except\\|finally") "except\\|finally")))) |