Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* RSPlugin>>#fecOopInitializePolyFieldSize:coefficients:coefficientsCount: */
- static sqInt
- fecOopInitializePolyFieldSizecoefficientscoefficientsCount(sqInt fieldSize, unsigned char *coefficients, sqInt coefficientsCount)
- {
- sqInt coefficientsLength;
- sqInt firstNonZero;
- sqInt index;
- unsigned char *mutableCoefficients;
- sqInt mutableCoefficientsCount;
- sqInt mutableCoefficientsOop;
- coefficientsLength = coefficientsCount;
- if (!((coefficientsLength > 1) && ((coefficients[0]) == 0))) {
- mutableCoefficientsCount = coefficientsCount;
- mutableCoefficientsOop = instantiateClassindexableSize(classByteArray(), mutableCoefficientsCount);
- /* begin arrayFromOop: */
- mutableCoefficients = firstIndexableField(mutableCoefficientsOop);
- for (index = 0; index < mutableCoefficientsCount; index += 1) {
- mutableCoefficients[index] = (coefficients[index]);
- return mutableCoefficientsOop;
- }
- }
- firstNonZero = 2;
- while ((firstNonZero <= coefficientsLength)
- && ((coefficients[firstNonZero]) == 0)) {
- firstNonZero += 1;
- }
- if (firstNonZero > coefficientsLength) {
- mutableCoefficientsCount = 1;
- mutableCoefficientsOop = instantiateClassindexableSize(classByteArray(), mutableCoefficientsCount);
- /* begin arrayFromOop: */
- mutableCoefficients = firstIndexableField(mutableCoefficientsOop);
- }
- else {
- mutableCoefficientsCount = coefficientsLength - firstNonZero;
- mutableCoefficientsOop = instantiateClassindexableSize(classByteArray(), mutableCoefficientsCount);
- /* begin arrayFromOop: */
- mutableCoefficients = firstIndexableField(mutableCoefficientsOop);
- for (index = 0; index < coefficientsLength; index += 1) {
- mutableCoefficients[index] = (coefficients[index + firstNonZero]);
- }
- }
- return mutableCoefficientsOop;
- }
Advertisement
Add Comment
Please, Sign In to add comment