Copyright is for creative work so if it really is the best way to do it, you should be safe even if the AI copied the idea from somebody else. You can't use copyright to restrict access to useful technology like a patent.
// bytes are added to the buffer until a value of bitwidth is available
for _ in 0..<bitWidth {
let byte = try UInt8(parsing: &input)
buffer |= UInt64(byte) << bitsInBuffer
bitsInBuffer += 8
// Values of bitwidth are right-shifted off the buffer.
while bitsInBuffer >= bitWidth && outPos < numValues {
let value = Int(buffer & mask)
out[outPos + outOffset] = value
outPos += 1
buffer >>= bitWidth
bitsInBuffer -= bitWidth
}
}it's also nonsense, so be careful how you try to apply said feedback