diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1a5b368270d3464c7b4a0ea6ab3133edb739cec7..e6e03389c2ce533b3660bc7096afd147c0e78aeb 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -26,7 +26,7 @@ extern "C" {
 #define AV_TOSTRING(s) #s
 #define LIBAVCODEC_IDENT	"FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)
 
-#define AV_NOPTS_VALUE 0x8000000000000000LL
+#define AV_NOPTS_VALUE int64_t_C(0x8000000000000000)
 #define AV_TIME_BASE 1000000
 
 enum CodecID {
diff --git a/libavcodec/common.h b/libavcodec/common.h
index d6d5cf28510c22e573fb477bb961e539cbbd94f1..8f88b34b57351569defa3646eac9e229306fbe2b 100644
--- a/libavcodec/common.h
+++ b/libavcodec/common.h
@@ -102,7 +102,7 @@ extern const struct AVOption avoptions_workaround_bug[11];
 #endif /* HAVE_INTTYPES_H */
 
 #ifndef INT64_MAX
-#define INT64_MAX 9223372036854775807LL
+#define INT64_MAX int64_t_C(9223372036854775807)
 #endif
 
 #ifdef EMULATE_FAST_INT