Skip to content

Commit e9b5344

Browse files
committed
Merged in cleanup/code_cleanup_flake8 (pull request #187)
Follow flake8 to pass tests Approved-by: Jose Rodriguez <boriel@gmail.com>
2 parents 47dd17f + 3e76ad5 commit e9b5344

2 files changed

Lines changed: 19 additions & 21 deletions

File tree

arch/zx48k/backend/__16bit.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -288,15 +288,14 @@ def _divu16(ins):
288288
'''
289289
op1, op2 = tuple(ins.quad[2:])
290290
if is_int(op1) and int(op1) == 0: # 0 / A = 0
291+
if op2[0] in ('_', '$'):
292+
output = [] # Optimization: Discard previous op if not from the stack
293+
else:
294+
output = _16bit_oper(op2) # Normalize stack
291295

292-
if op2[0] in ('_', '$'):
293-
output = [] # Optimization: Discard previous op if not from the stack
294-
else:
295-
output = _16bit_oper(op2) # Normalize stack
296-
297-
output.append('ld hl, 0')
298-
output.append('push hl')
299-
return output
296+
output.append('ld hl, 0')
297+
output.append('push hl')
298+
return output
300299

301300
if is_int(op2):
302301
op = int16(op2)
@@ -349,15 +348,14 @@ def _divi16(ins):
349348
'''
350349
op1, op2 = tuple(ins.quad[2:])
351350
if is_int(op1) and int(op1) == 0: # 0 / A = 0
351+
if op2[0] in ('_', '$'):
352+
output = [] # Optimization: Discard previous op if not from the stack
353+
else:
354+
output = _16bit_oper(op2) # Normalize stack
352355

353-
if op2[0] in ('_', '$'):
354-
output = [] # Optimization: Discard previous op if not from the stack
355-
else:
356-
output = _16bit_oper(op2) # Normalize stack
357-
358-
output.append('ld hl, 0')
359-
output.append('push hl')
360-
return output
356+
output.append('ld hl, 0')
357+
output.append('push hl')
358+
return output
361359

362360
if is_int(op2):
363361
op = int16(op2)

arch/zx48k/backend/__f16.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ def _modf16(ins):
304304
op1, op2 = tuple(ins.quad[2:])
305305

306306
if is_float(op2) and float(op2) == 1:
307-
output = _f16_oper(op1)
308-
output.append('ld hl, 0')
309-
output.append('push hl')
310-
output.append('push hl')
311-
return output
307+
output = _f16_oper(op1)
308+
output.append('ld hl, 0')
309+
output.append('push hl')
310+
output.append('push hl')
311+
return output
312312

313313
rev = not is_float(op1) and op1[0] != 't' and op2[0] == 't'
314314

0 commit comments

Comments
 (0)