| 1 | package io.github.humbleui.skija; |
| 2 | |
| 3 | public interface FourByteTag { |
| 4 | static int fromString(String name) { |
| 5 | assert name.length() == 4 : "Name must be exactly 4 symbols, got: '" + name + "'"; |
| 6 | return (name.charAt(0) & 0xFF) << 24 |
| 7 | | (name.charAt(1) & 0xFF) << 16 |
| 8 | | (name.charAt(2) & 0xFF) << 8 |
| 9 | | (name.charAt(3) & 0xFF); |
| 10 | |
| 11 | } |
| 12 | |
| 13 | static String toString(int tag) { |
| 14 | return new String(new byte[] { (byte) (tag >> 24 & 0xFF), |
| 15 | (byte) (tag >> 16 & 0xFF), |
| 16 | (byte) (tag >> 8 & 0xFF), |
| 17 | (byte) (tag & 0xFF) }); |
| 18 | } |
| 19 | } |
no outgoing calls
no test coverage detected