Browse code

Small changes to simplify code

Andrew Alderwick authored on 20/04/2021 21:56:45
Showing 1 changed files
... ...
@@ -255,7 +255,7 @@ audio_poke(Uxn *u, Uint8 *m, Uint8 b0, Uint8 b1)
255 255
 			apu.queue->dat = SDL_realloc(apu.queue->dat, apu.queue->sz * sizeof(*apu.queue->dat));
256 256
 		}
257 257
 		if(apu.queue->is_envelope)
258
-			apu.queue->dat[apu.queue->n++] = (m[0xb] << 7) + (m[0xc] >> 1);
258
+			apu.queue->dat[apu.queue->n++] = genpeek16(m, 0xb) >> 1;
259 259
 		else
260 260
 			apu.queue->dat[apu.queue->n++] = genpeek16(m, 0xb) + 0x8000;
261 261
 		apu.queue->dat[apu.queue->n++] = (m[0xd] << 8) + b1;
... ...
@@ -280,16 +280,14 @@ datetime_poke(Uxn *u, Uint8 *m, Uint8 b0, Uint8 b1)
280 280
 	time_t seconds = time(NULL);
281 281
 	struct tm *t = localtime(&seconds);
282 282
 	t->tm_year += 1900;
283
-	m[0x0] = (t->tm_year & 0xff00) >> 8;
284
-	m[0x1] = t->tm_year & 0xff;
283
+	genpoke16(m, 0x0, t->tm_year);
285 284
 	m[0x2] = t->tm_mon;
286 285
 	m[0x3] = t->tm_mday;
287 286
 	m[0x4] = t->tm_hour;
288 287
 	m[0x5] = t->tm_min;
289 288
 	m[0x6] = t->tm_sec;
290 289
 	m[0x7] = t->tm_wday;
291
-	m[0x8] = (t->tm_yday & 0xff00) >> 8;
292
-	m[0x9] = t->tm_yday & 0xff;
290
+	genpoke16(m, 0x08, t->tm_yday);
293 291
 	m[0xa] = t->tm_isdst;
294 292
 	(void)u;
295 293
 	(void)b0;