// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package ianaindex

import (
	
	

	
	
	
	
)

type asciiDecoder struct {
	transform.NopResetter
}

func ( asciiDecoder) (,  []byte,  bool) (,  int,  error) {
	for ,  := range  {
		if  > unicode.MaxASCII {
			 := unicode.ReplacementChar
			if +utf8.RuneLen() > len() {
				 = transform.ErrShortDst
				break
			}
			 += utf8.EncodeRune([:], )
			++
			continue
		}

		if  >= len() {
			 = transform.ErrShortDst
			break
		}
		[] = 
		++
		++
	}
	return , , 
}

type asciiEncoder struct {
	transform.NopResetter
}

func ( asciiEncoder) (,  []byte,  bool) (,  int,  error) {
	for ,  := range  {
		if  > unicode.MaxASCII {
			 = internal.RepertoireError(encoding.ASCIISub)
			break
		}

		if  >= len() {
			 = transform.ErrShortDst
			break
		}
		[] = 
		++
		++
	}
	return , , 
}

var asciiEnc = &internal.Encoding{
	Encoding: &internal.SimpleEncoding{
		Decoder: asciiDecoder{},
		Encoder: asciiEncoder{},
	},
	Name: "US-ASCII",
	MIB:  identifier.ASCII,
}