Remove last use of the MIN macro.

We use functions for this instead.
This commit is contained in:
iphydf 2018-08-12 10:59:56 +00:00
parent 503d9f7e22
commit 5d15b5930d
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
3 changed files with 8 additions and 6 deletions

View File

@ -245,18 +245,14 @@ void toxav_iterate(ToxAV *av)
ac_iterate(i->audio.second);
vc_iterate(i->video.second);
// TODO(iphydf): Find out what MIN-semantics are desired here and
// use a min_* function from util.h.
#define MIN(a,b) (((a)<(b))?(a):(b))
if (i->msi_call->self_capabilities & msi_CapRAudio &&
i->msi_call->peer_capabilities & msi_CapSAudio) {
rc = MIN(i->audio.second->lp_frame_duration, rc);
rc = min_s32(i->audio.second->lp_frame_duration, rc);
}
if (i->msi_call->self_capabilities & msi_CapRVideo &&
i->msi_call->peer_capabilities & msi_CapSVideo) {
rc = MIN(i->video.second->lcfd, (uint32_t) rc);
rc = min_u32(i->video.second->lcfd, rc);
}
uint32_t fid = i->friend_number;

View File

@ -100,6 +100,11 @@ int32_t max_s32(int32_t a, int32_t b)
return a > b ? a : b;
}
int32_t min_s32(int32_t a, int32_t b)
{
return a < b ? a : b;
}
uint32_t min_u32(uint32_t a, uint32_t b)
{
return a < b ? a : b;

View File

@ -47,6 +47,7 @@ void net_to_host(uint8_t *num, uint16_t numbytes);
int create_recursive_mutex(pthread_mutex_t *mutex);
int32_t max_s32(int32_t a, int32_t b);
int32_t min_s32(int32_t a, int32_t b);
uint32_t min_u32(uint32_t a, uint32_t b);
uint64_t min_u64(uint64_t a, uint64_t b);