"""Generate a tiny unlocked classic Garmin IMG with one RGN vector feature. Only for exercising the converter's control flow, NOT a real-world compatibility test. """ from pathlib import Path import struct import sys def u24(n): return (n & 0xffffff).to_bytes(3,'little') def coord(deg):return round(deg*(1<<24)/360) def bitstream(values): bits = [1,0,1,0] # x same-sign+, y same-sign+ for x,y in values: for value in (x,y): bits += [(value >> i)&1 for i in range(11)] return bytes(sum(bits[i+j]<