44 lines
929 B
C
44 lines
929 B
C
/*
|
|
* helper_impl.c
|
|
* Implementacje funkcji z helper.h (tylko extern, nie inline)
|
|
*/
|
|
|
|
#include "tdefs.h"
|
|
#include "helper.h"
|
|
#include <stdint.h>
|
|
|
|
// Implementacja czy_test_R
|
|
int czy_test_R() {
|
|
return 0;
|
|
}
|
|
|
|
// Implementacja sprawdz_P
|
|
void sprawdz_P(u8 *Wy, u8 P, u8 O, short *lp, short iz, short io) {
|
|
if (O) {
|
|
*Wy = 0;
|
|
*lp = 0;
|
|
} else if (P) {
|
|
if (*lp < iz) (*lp)++;
|
|
if (*lp >= iz) *Wy = 1;
|
|
} else {
|
|
if (*lp > 0) (*lp)--;
|
|
if (*lp == 0) *Wy = 0;
|
|
}
|
|
}
|
|
|
|
// Implementacja sprawdz_P_100 (używana w wielu miejscach)
|
|
void sprawdz_P_100(u8 *Wy, u8 P, u8 O, short *lp, short iz, short io) {
|
|
sprawdz_P(Wy, P, O, lp, iz, io);
|
|
}
|
|
|
|
// Implementacja set_bit_ptr_struct
|
|
int set_bit_ptr_struct(u32 io, struct binary_io *b) {
|
|
if (!b || !b->ptr) return 0;
|
|
if (io) {
|
|
*b->ptr |= b->bit_mask;
|
|
} else {
|
|
*b->ptr &= ~b->bit_mask;
|
|
}
|
|
return 1;
|
|
}
|