124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
unsigned long hash;
float tmp;
OFHashInit(&hash);
tmp = OFToLittleEndianFloat(_red);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAdd(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(_green);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAdd(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(_blue);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAdd(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(_alpha);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAdd(&hash, ((char *)&tmp)[i]);
OFHashFinalize(&hash);
return hash;
}
- (void)getRed: (float *)red
|
|
|
|
|
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
unsigned long hash;
float tmp;
OFHashInit(&hash);
tmp = OFToLittleEndianFloat(_red);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAddByte(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(_green);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAddByte(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(_blue);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAddByte(&hash, ((char *)&tmp)[i]);
tmp = OFToLittleEndianFloat(_alpha);
for (uint_fast8_t i = 0; i < sizeof(float); i++)
OFHashAddByte(&hash, ((char *)&tmp)[i]);
OFHashFinalize(&hash);
return hash;
}
- (void)getRed: (float *)red
|