Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetBytes() [4/9]

unsafe override int System.Text.UTF32Encoding.GetBytes ( char[] chars,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex )
inline

Definition at line 176 of file UTF32Encoding.cs.

177 {
178 if (chars == null || bytes == null)
179 {
180 throw new ArgumentNullException((chars == null) ? "chars" : "bytes", SR.ArgumentNull_Array);
181 }
182 if (charIndex < 0 || charCount < 0)
183 {
184 throw new ArgumentOutOfRangeException((charIndex < 0) ? "charIndex" : "charCount", SR.ArgumentOutOfRange_NeedNonNegNum);
185 }
186 if (chars.Length - charIndex < charCount)
187 {
188 throw new ArgumentOutOfRangeException("chars", SR.ArgumentOutOfRange_IndexCountBuffer);
189 }
190 if (byteIndex < 0 || byteIndex > bytes.Length)
191 {
192 throw new ArgumentOutOfRangeException("byteIndex", SR.ArgumentOutOfRange_Index);
193 }
194 if (charCount == 0)
195 {
196 return 0;
197 }
198 int byteCount = bytes.Length - byteIndex;
199 fixed (char* ptr = chars)
200 {
201 fixed (byte* ptr2 = &MemoryMarshal.GetReference<byte>(bytes))
202 {
203 return GetBytes(ptr + charIndex, charCount, ptr2 + byteIndex, byteCount, null);
204 }
205 }
206 }
unsafe override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)

References System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_Index, System.SR.ArgumentOutOfRange_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, and System.Text.UTF32Encoding.GetBytes().