MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_setEncoding_

Function UArray_setEncoding_

libs/basekit/source/UArray.c:215–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213CENCODING UArray_encoding(const UArray *self) { return self->encoding; }
214
215void UArray_setEncoding_(UArray *self, CENCODING encoding) {
216 // ensure that size matches new encoding
217
218 switch (encoding) {
219 case CENCODING_ASCII:
220 case CENCODING_UTF8:
221 UArray_setItemType_(self, CTYPE_uint8_t);
222 break;
223 case CENCODING_UCS2:
224 UArray_setItemType_(self, CTYPE_uint16_t);
225 break;
226 case CENCODING_UCS4:
227 UArray_setItemType_(self, CTYPE_uint32_t);
228 break;
229 case CENCODING_NUMBER:
230 // Don't change itemType when setting raw encoding. Raw encoding
231 // used for vectors and numbers and the item type may have been set
232 // before this call.
233 break;
234 }
235
236 self->encoding = encoding;
237}
238
239void UArray_convertToEncoding_(UArray *self, CENCODING encoding) {
240 switch (encoding) {

Callers 12

UArray_copy_Function · 0.85
UArray_asUTF8Function · 0.85
UArray_asUCS2Function · 0.85
UArray_asUCS4Function · 0.85
IoSeq_immutable.cFile · 0.85
IoSeq_mutable.cFile · 0.85
IoNumber.cFile · 0.85
IoList.cFile · 0.85

Calls 1

UArray_setItemType_Function · 0.85

Tested by

no test coverage detected